Class: Statesman::EventTransitions

Inherits:
Object
  • Object
show all
Defined in:
lib/statesman/event_transitions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(machine, event_name, &block) ⇒ EventTransitions

Returns a new instance of EventTransitions.



5
6
7
8
9
# File 'lib/statesman/event_transitions.rb', line 5

def initialize(machine, event_name, &block)
  @machine    = machine
  @event_name = event_name
  instance_eval(&block)
end

Instance Attribute Details

#event_nameObject (readonly)

Returns the value of attribute event_name.



3
4
5
# File 'lib/statesman/event_transitions.rb', line 3

def event_name
  @event_name
end

#machineObject (readonly)

Returns the value of attribute machine.



3
4
5
# File 'lib/statesman/event_transitions.rb', line 3

def machine
  @machine
end

Instance Method Details

#transition(options = { from: nil, to: nil }) ⇒ Object



11
12
13
# File 'lib/statesman/event_transitions.rb', line 11

def transition(options = { from: nil, to: nil })
  machine.transition(options, event_name)
end