Class: SimpleStateMachine::Decorator
- Inherits:
-
Object
- Object
- SimpleStateMachine::Decorator
- Defined in:
- lib/simple_state_machine/simple_state_machine.rb
Overview
Decorates @subject with methods to access the state machine
Direct Known Subclasses
Instance Attribute Summary collapse
-
#subject ⇒ Object
writeonly
Sets the attribute subject.
Instance Method Summary collapse
- #decorate(transition) ⇒ Object
-
#initialize(subject) ⇒ Decorator
constructor
A new instance of Decorator.
Constructor Details
#initialize(subject) ⇒ Decorator
Returns a new instance of Decorator.
215 216 217 218 219 220 |
# File 'lib/simple_state_machine/simple_state_machine.rb', line 215 def initialize(subject) @subject = subject define_state_machine_method define_state_getter_method define_state_setter_method end |
Instance Attribute Details
#subject=(value) ⇒ Object (writeonly)
Sets the attribute subject
214 215 216 |
# File 'lib/simple_state_machine/simple_state_machine.rb', line 214 def subject=(value) @subject = value end |
Instance Method Details
#decorate(transition) ⇒ Object
222 223 224 225 226 227 |
# File 'lib/simple_state_machine/simple_state_machine.rb', line 222 def decorate transition define_state_helper_method(transition.from) define_state_helper_method(transition.to) define_event_method(transition.event_name) decorate_event_method(transition.event_name) end |