Class: StateStep::StateTrans
- Inherits:
-
Object
- Object
- StateStep::StateTrans
- Defined in:
- lib/state_step/state_trans.rb
Instance Attribute Summary collapse
-
#action_name ⇒ Object
readonly
Returns the value of attribute action_name.
-
#stFrom ⇒ Object
readonly
Returns the value of attribute stFrom.
-
#stTo ⇒ Object
readonly
Returns the value of attribute stTo.
Instance Method Summary collapse
-
#initialize(from, to, name, &block) ⇒ StateTrans
constructor
A new instance of StateTrans.
- #trigger ⇒ Object
Constructor Details
#initialize(from, to, name, &block) ⇒ StateTrans
Returns a new instance of StateTrans.
8 9 10 11 12 13 |
# File 'lib/state_step/state_trans.rb', line 8 def initialize(from, to, name, &block) @stFrom = from @stTo = to @action_name = name @callback = block end |
Instance Attribute Details
#action_name ⇒ Object (readonly)
Returns the value of attribute action_name.
7 8 9 |
# File 'lib/state_step/state_trans.rb', line 7 def action_name @action_name end |
#stFrom ⇒ Object (readonly)
Returns the value of attribute stFrom.
7 8 9 |
# File 'lib/state_step/state_trans.rb', line 7 def stFrom @stFrom end |
#stTo ⇒ Object (readonly)
Returns the value of attribute stTo.
7 8 9 |
# File 'lib/state_step/state_trans.rb', line 7 def stTo @stTo end |
Instance Method Details
#trigger ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/state_step/state_trans.rb', line 15 def trigger st = @callback.call StateStep.logger.debug "st.nil? : #{st.nil?} / st = '#{st}'" if st.nil? or st == true StateStep.logger.debug "Status changed!" @stTo else StateStep.logger.debug "Status reverted!" @stFrom end end |