Class: Brainguy::FluentEmitter
- Defined in:
- lib/brainguy/fluent_emitter.rb
Overview
A wrapper for a Emitter that enables a "fluent API" by
returning self
from each method.
Constant Summary
Constants inherited from Emitter
Instance Method Summary collapse
-
#attach ⇒ Subscription
Attach a new object to listen for events.
-
#on ⇒ Object
Attach blocks of code to handle specific named events.
Methods inherited from Emitter
#detach, #emit, #initialize, new_from_existing, #subscriptions, #with_subscription_scope
Constructor Details
This class inherits a constructor from Brainguy::Emitter
Instance Method Details
#attach ⇒ Subscription
Attach a new object to listen for events. A listener is expected to be
call-able, and it will receive the #call
message with an Event each
time one is emitted.
25 26 27 28 |
# File 'lib/brainguy/fluent_emitter.rb', line 25 def attach(*) super self end |
#on(name, &block) ⇒ Object #on(handlers) ⇒ Object
Attach blocks of code to handle specific named events.
18 19 20 21 |
# File 'lib/brainguy/fluent_emitter.rb', line 18 def on(*) super self end |