class Pry::CommandState

CommandState is a data structure to hold per-command state.

Pry commands can store arbitrary state here. This state persists between subsequent command invocations. All state saved here is unique to the command.

@since v0.13.0 @api private

Public Class Methods

default() click to toggle source
# File lib/pry/command_state.rb, line 15
def self.default
  @default ||= new
end
new() click to toggle source
# File lib/pry/command_state.rb, line 19
def initialize
  @command_state = {}
end

Public Instance Methods

reset(command_name) click to toggle source
# File lib/pry/command_state.rb, line 27
def reset(command_name)
  @command_state[command_name] = OpenStruct.new
end
state_for(command_name) click to toggle source
# File lib/pry/command_state.rb, line 23
def state_for(command_name)
  @command_state[command_name] ||= OpenStruct.new
end