Class: ZeevexConcurrency::EventLoop::Null
- Inherits:
-
Object
- Object
- ZeevexConcurrency::EventLoop::Null
- Defined in:
- lib/zeevex_concurrency/event_loop.rb
Overview
event loop which throws away all events without running, returning nil from all promises
Instance Method Summary collapse
- #enqueue(callable = nil, &block) ⇒ Object
- #in_event_loop? ⇒ Boolean
-
#initialize(options = {}) ⇒ Null
constructor
A new instance of Null.
- #on_event_loop(runnable = nil, &block) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Null
Returns a new instance of Null.
127 |
# File 'lib/zeevex_concurrency/event_loop.rb', line 127 def initialize( = {}); end |
Instance Method Details
#enqueue(callable = nil, &block) ⇒ Object
130 131 132 133 134 |
# File 'lib/zeevex_concurrency/event_loop.rb', line 130 def enqueue(callable = nil, &block) to_run = ZeevexConcurrency::Promise.new unless to_run.is_a?(ZeevexConcurrency::Delayed) to_run.set_result { nil } to_run end |
#in_event_loop? ⇒ Boolean
135 |
# File 'lib/zeevex_concurrency/event_loop.rb', line 135 def in_event_loop?; false; end |
#on_event_loop(runnable = nil, &block) ⇒ Object
136 137 138 |
# File 'lib/zeevex_concurrency/event_loop.rb', line 136 def on_event_loop(runnable = nil, &block) enqueue(runnable, &block) end |
#start ⇒ Object
128 |
# File 'lib/zeevex_concurrency/event_loop.rb', line 128 def start; end |
#stop ⇒ Object
129 |
# File 'lib/zeevex_concurrency/event_loop.rb', line 129 def stop; end |