Class: Mongoid::StateMachine::SupportingClasses::State
- Inherits:
-
Object
- Object
- Mongoid::StateMachine::SupportingClasses::State
- Defined in:
- lib/mongoid/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.
20 21 22 |
# File 'lib/mongoid/state_machine.rb', line 20 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
20 21 22 |
# File 'lib/mongoid/state_machine.rb', line 20 def value @value end |
Instance Method Details
#entered(record) ⇒ Object
34 35 36 |
# File 'lib/mongoid/state_machine.rb', line 34 def entered(record) @after.each { |action| record.send(:run_transition_action, action) } end |
#entering(record) ⇒ Object
30 31 32 |
# File 'lib/mongoid/state_machine.rb', line 30 def entering(record) record.send(:run_transition_action, @enter) end |
#exited(record) ⇒ Object
38 39 40 |
# File 'lib/mongoid/state_machine.rb', line 38 def exited(record) record.send(:run_transition_action, @exit) end |