Method: StateMachine::Callback#call
- Defined in:
- lib/state_machine/callback.rb
#call(object, context = {}, *args, &block) ⇒ Object
Runs the callback as long as the transition context matches the branch requirements configured for this callback. If a block is provided, it will be called when the last method has run.
If a terminator has been configured and it matches the result from the evaluated method, then the callback chain should be halted.
157 158 159 160 161 162 163 164 |
# File 'lib/state_machine/callback.rb', line 157 def call(object, context = {}, *args, &block) if @branch.matches?(object, context) run_methods(object, context, 0, *args, &block) true else false end end |