Method: FSM::Observer#wait_for_entry

Defined in:
lib/fsm-0.0.0/observer.rb

#wait_for_entry(fstate, &hook) ⇒ Object Also known as: wait_for



116
117
118
119
120
121
122
123
124
# File 'lib/fsm-0.0.0/observer.rb', line 116

def wait_for_entry fstate, &hook
  argv = [fstate]
  unless fsm.state == fstate
    q = Queue.new
    once_on(Event::Entry, fstate){|*a| q.push a }
    argv.replace q.pop
  end
  icall hook, *argv if hook
end