Method: FSM::Observer#wait_for_input

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

#wait_for_input(fstate, &hook) ⇒ Object



147
148
149
150
151
152
153
154
155
# File 'lib/fsm-0.0.0/observer.rb', line 147

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