Class: ScottBarron::Acts::StateMachine::SupportingClasses::State
- Inherits:
-
Object
- Object
- ScottBarron::Acts::StateMachine::SupportingClasses::State
- Defined in:
- lib/acts_as_state_machine.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #entered(record) ⇒ Object
- #entering(record) ⇒ Object
- #exited(record) ⇒ Object
-
#initialize(name, options) ⇒ State
constructor
A new instance of State.
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/acts_as_state_machine.rb', line 18 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
18 19 20 |
# File 'lib/acts_as_state_machine.rb', line 18 def value @value end |
Instance Method Details
#entered(record) ⇒ Object
32 33 34 |
# File 'lib/acts_as_state_machine.rb', line 32 def entered(record) @after.each { |action| record.send(:run_transition_action, action) } end |
#entering(record) ⇒ Object
28 29 30 |
# File 'lib/acts_as_state_machine.rb', line 28 def entering(record) record.send(:run_transition_action, @enter) end |
#exited(record) ⇒ Object
36 37 38 |
# File 'lib/acts_as_state_machine.rb', line 36 def exited(record) record.send(:run_transition_action, @exit) end |