mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
0871ac65f6
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. |
||
---|---|---|
.. | ||
pry | ||
pry.rb |