Method: Workflow::Event#initialize
- Defined in:
- lib/workflow/event.rb
#initialize(name, transitions_to, condition = nil, meta = {}, &action) ⇒ Event
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/workflow/event.rb', line 6 def initialize(name, transitions_to, condition = nil, = {}, &action) @name = name @transitions_to = transitions_to.to_sym = @action = action @condition = if condition.nil? || condition.is_a?(Symbol) || condition.respond_to?(:call) condition else raise TypeError, 'condition must be nil, an instance method name symbol or a callable (eg. a proc or lambda)' end end |