Class: Hifsm::DSL::EventBuilder

Inherits:
AbstractBuilder show all
Defined in:
lib/hifsm/dsl/event_builder.rb

Overview

Normalizes event definitions to form => [], :to => …, :guard => …, before, after

Instance Method Summary collapse

Methods inherited from AbstractBuilder

define_dsl_callback, #each

Constructor Details

#initialize(options, &block) ⇒ EventBuilder

Returns a new instance of EventBuilder.



7
8
9
10
11
# File 'lib/hifsm/dsl/event_builder.rb', line 7

def initialize(options, &block)
  super()
  build_def(options) if options[:to]
  instance_eval(&block) if block
end

Instance Method Details

#from(state, options) ⇒ Object

from :state, :to => :state



18
19
20
# File 'lib/hifsm/dsl/event_builder.rb', line 18

def from(state, options)
  build_def(options.dup.merge(:from => state))
end