Class: Cognizant::Process::Triggers::Transition
- Defined in:
- lib/cognizant/process/triggers/transition.rb
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ Transition
constructor
A new instance of Transition.
- #notify(transition) ⇒ Object
- #reset! ⇒ Object
Constructor Details
#initialize(options = {}, &block) ⇒ Transition
Returns a new instance of Transition.
5 6 7 8 9 |
# File 'lib/cognizant/process/triggers/transition.rb', line 5 def initialize( = {}, &block) @from = [*[:from]] @to = [*[:to]] @do = block end |
Instance Method Details
#notify(transition) ⇒ Object
11 12 13 14 15 |
# File 'lib/cognizant/process/triggers/transition.rb', line 11 def notify(transition) if @from.include?(transition.from_name) and @to.include?(transition.to_name) @do.call(@delegate.process) if @do and @do.respond_to?(:call) end end |
#reset! ⇒ Object
17 18 |
# File 'lib/cognizant/process/triggers/transition.rb', line 17 def reset! end |