Method: Celerb::ResultConsumer#initialize

Defined in:
lib/celerb/result_consumer.rb

#initialize(channel, opts = {}) ⇒ ResultConsumer

Returns a new instance of ResultConsumer.



4
5
6
7
8
9
10
11
12
# File 'lib/celerb/result_consumer.rb', line 4

def initialize channel, opts={}
  @channel = channel
  @options = opts
  @handlers = {}
  EM.add_periodic_timer(60) do
    now = Time.now
    @handlers.delete_if {|id,h| h[:expires] < now}
  end
end