Class: AMQP::SpecHelper::EMExample
- Inherits:
-
EventedExample
- Object
- EventedExample
- AMQP::SpecHelper::EMExample
- Defined in:
- lib/amqp-spec/evented_example.rb
Overview
Represents spec running inside EM.run loop
Instance Method Summary collapse
-
#done(delay = nil) ⇒ Object
Breaks the EM event loop and finishes the spec.
-
#run ⇒ Object
Run @block inside the EM.run event loop.
Methods inherited from EventedExample
#finish_em_loop, #finish_example, #initialize, #run_em_hooks, #run_em_loop, #timeout
Constructor Details
This class inherits a constructor from AMQP::SpecHelper::EventedExample
Instance Method Details
#done(delay = nil) ⇒ Object
Breaks the EM event loop and finishes the spec. Done yields to any given block first, then stops EM event loop.
108 109 110 111 112 113 114 115 |
# File 'lib/amqp-spec/evented_example.rb', line 108 def done(delay = nil) super(delay) do yield if block_given? EM.next_tick do finish_em_loop end end end |
#run ⇒ Object
Run @block inside the EM.run event loop
101 102 103 |
# File 'lib/amqp-spec/evented_example.rb', line 101 def run run_em_loop &@block end |