Class: Hifsm::DSL::EventBuilder
- Inherits:
-
AbstractBuilder
- Object
- AbstractBuilder
- Hifsm::DSL::EventBuilder
- Defined in:
- lib/hifsm/dsl/event_builder.rb
Overview
Normalizes event definitions to form => [], :to => …, :guard => …, before, after
Instance Method Summary collapse
-
#from(state, options) ⇒ Object
from :state, :to => :state.
-
#initialize(options, &block) ⇒ EventBuilder
constructor
A new instance of EventBuilder.
Methods inherited from AbstractBuilder
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(, &block) super() build_def() if [: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, ) build_def(.dup.merge(:from => state)) end |