Class: SimpleStateMachine::Decorator::Default
- Inherits:
-
Object
- Object
- SimpleStateMachine::Decorator::Default
- Defined in:
- lib/simple_state_machine/decorator/default.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) ⇒ Default
constructor
A new instance of Default.
Constructor Details
#initialize(subject) ⇒ Default
Returns a new instance of Default.
8 9 10 |
# File 'lib/simple_state_machine/decorator/default.rb', line 8 def initialize(subject) @subject = subject end |
Instance Attribute Details
#subject=(value) ⇒ Object (writeonly)
Sets the attribute subject
7 8 9 |
# File 'lib/simple_state_machine/decorator/default.rb', line 7 def subject=(value) @subject = value end |
Instance Method Details
#decorate(transition) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/simple_state_machine/decorator/default.rb', line 12 def decorate transition define_state_machine_method define_state_getter_method define_state_setter_method 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 |