Class: Pry::CommandState Private

Inherits:
Object show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/command_state.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommandState

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CommandState.

Since:

  • v0.13.0



19
20
21
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/command_state.rb', line 19

def initialize
  @command_state = {}
end

Class Method Details

.defaultObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • v0.13.0



15
16
17
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/command_state.rb', line 15

def self.default
  @default ||= new
end

Instance Method Details

#reset(command_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • v0.13.0



27
28
29
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/command_state.rb', line 27

def reset(command_name)
  @command_state[command_name] = OpenStruct.new
end

#state_for(command_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • v0.13.0



23
24
25
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/command_state.rb', line 23

def state_for(command_name)
  @command_state[command_name] ||= OpenStruct.new
end