Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (37 sloc) 0.772 kB
module Daikon
class Reactor
attr_reader :current_time, :info_collector
attr_writer :callback, :info_interval
def initialize(client = nil)
@client = client
end
def info_interval
@info_interval ||= 10
end
def info_collector
@info_collector ||= connect
end
def start
EventMachine.add_periodic_timer(@info_interval) do
@current_time = Time.now
collect_info
callback
end
end
def collect_info
info_collector.info do |info|
@client.report_info(info)
callback
end
end
private
def callback
if @callback && @callback.call(self)
EventMachine.stop
end
end
def connect
@client.connect
end
end
end
Jump to Line
Something went wrong with that request. Please try again.