Class: Healthyr::EventAgent::AgentThread

Inherits:
Object
  • Object
show all
Defined in:
lib/healthyr/event_agent.rb

Instance Method Summary collapse

Constructor Details

#initialize(duration, &block) ⇒ AgentThread

Returns a new instance of AgentThread.



37
38
39
40
41
42
43
44
45
# File 'lib/healthyr/event_agent.rb', line 37

def initialize(duration, &block)
  Thread.abort_on_exception = true
  Thread.new do
    while true
      sleep duration
      block.call
    end
  end
end