class EventMachine::Test
Public Class Methods
new(timeout)
click to toggle source
Calls superclass method
# File lib/event_machine/test.rb, line 8 def initialize(timeout) super() do define_method(:em_test) do |&block| done_callback = -> { throw :stop } # Calling EM.stop does not work, since it waits for the timer to finish first. catch(:stop) do EventMachine.run do EventMachine.add_timer(timeout) { raise TimeoutError } block.call(done_callback) end end end end end