Class: StateDesignPattern::BaseState
- Inherits:
-
Object
- Object
- StateDesignPattern::BaseState
- Defined in:
- lib/state_design_pattern/base_state.rb
Instance Attribute Summary collapse
-
#state_machine ⇒ Object
readonly
Returns the value of attribute state_machine.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(state_machine) ⇒ BaseState
constructor
A new instance of BaseState.
Constructor Details
#initialize(state_machine) ⇒ BaseState
Returns a new instance of BaseState.
7 8 9 |
# File 'lib/state_design_pattern/base_state.rb', line 7 def initialize(state_machine) @state_machine = state_machine end |
Instance Attribute Details
#state_machine ⇒ Object (readonly)
Returns the value of attribute state_machine.
5 6 7 |
# File 'lib/state_design_pattern/base_state.rb', line 5 def state_machine @state_machine end |
Class Method Details
.def_action(action_name) ⇒ Object
21 22 23 24 25 |
# File 'lib/state_design_pattern/base_state.rb', line 21 def self.def_action(action_name) define_method(action_name) do |*args| raise IllegalStateException end end |
.def_actions(*actions) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/state_design_pattern/base_state.rb', line 11 def self.def_actions(*actions) define_method(:actions) do actions end actions.each do |action| def_action(action) end end |