1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/lib
John Mair 0871ac65f6 Provide a place for commands to store state.
Commands can store state on an  `OpenStruct` exposed via the `state` method.
This `OpenStruct` is guaranteed to be unique to the command and to the associated Pry instance.

e.g

create_command "my-test" do
  def process
    state.my_state ||= 0
    state.my_state += 1
  end
end

The above `state.my_state` variable will increment by one for each invocation of `my-test`.
Further, it will not intefere with any state on `my-test` for any other Pry instance or with
any `state.my_state` variables defined for other commands on the same Pry instance.
2012-06-16 00:45:04 +12:00
..
pry Provide a place for commands to store state. 2012-06-16 00:45:04 +12:00
pry.rb Fix whereami inside __binding_impl__ 2012-06-10 23:42:15 -07:00