Class: StatePattern::State
- Inherits:
-
Object
- Object
- StatePattern::State
- Defined in:
- lib/state_pattern/state.rb
Instance Attribute Summary collapse
-
#stateable ⇒ Object
readonly
Returns the value of attribute stateable.
Instance Method Summary collapse
-
#initialize(stateable) ⇒ State
constructor
A new instance of State.
- #state ⇒ Object
- #transition_to(state_class) ⇒ Object
Constructor Details
#initialize(stateable) ⇒ State
Returns a new instance of State.
4 5 6 |
# File 'lib/state_pattern/state.rb', line 4 def initialize(stateable) @stateable = stateable end |
Instance Attribute Details
#stateable ⇒ Object (readonly)
Returns the value of attribute stateable.
3 4 5 |
# File 'lib/state_pattern/state.rb', line 3 def stateable @stateable end |
Instance Method Details
#state ⇒ Object
12 13 14 |
# File 'lib/state_pattern/state.rb', line 12 def state self.class.to_s end |
#transition_to(state_class) ⇒ Object
8 9 10 |
# File 'lib/state_pattern/state.rb', line 8 def transition_to(state_class) @stateable.transition_to(state_class) end |