Class: Flamingo::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/flamingo/dispatcher.rb

Instance Method Summary collapse

Constructor Details

#initializeDispatcher

Returns a new instance of Dispatcher.



4
5
6
# File 'lib/flamingo/dispatcher.rb', line 4

def initialize
  @shutdown = false
end

Instance Method Details

#run(wait_time = 0.5) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/flamingo/dispatcher.rb', line 12

def run(wait_time=0.5)
  init_event_log
  while(!@shutdown) do
    if event = next_event
      dispatch(event)
    else
      if wait_time == 0
        stop
      else
        wait(wait_time)
      end
    end
  end     
end

#stopObject



8
9
10
# File 'lib/flamingo/dispatcher.rb', line 8

def stop
  @shutdown = true  
end