Class: Sysdo::EventSource
- Inherits:
-
Object
- Object
- Sysdo::EventSource
- Defined in:
- lib/sysdo/event_source.rb,
lib/sysdo/event_source/polled_change.rb,
lib/sysdo/event_source/polled_equal_change.rb,
lib/sysdo/event_source/polled_collection_change.rb
Direct Known Subclasses
Defined Under Namespace
Classes: PolledChange, PolledCollectionChange, PolledEqualChange
Instance Attribute Summary collapse
-
#on_fire ⇒ Object
Returns the value of attribute on_fire.
Instance Method Summary collapse
- #fire(*args, **kwargs) ⇒ Object
-
#initialize(&listener) ⇒ EventSource
constructor
A new instance of EventSource.
- #listen ⇒ Object
Constructor Details
#initialize(&listener) ⇒ EventSource
Returns a new instance of EventSource.
5 6 7 8 |
# File 'lib/sysdo/event_source.rb', line 5 def initialize(&listener) @listener = listener @on_fire = ->{} end |
Instance Attribute Details
#on_fire ⇒ Object
Returns the value of attribute on_fire.
3 4 5 |
# File 'lib/sysdo/event_source.rb', line 3 def on_fire @on_fire end |
Instance Method Details
#fire(*args, **kwargs) ⇒ Object
10 11 12 |
# File 'lib/sysdo/event_source.rb', line 10 def fire(*args, **kwargs) @on_fire.(*args, **kwargs) end |
#listen ⇒ Object
14 15 16 17 |
# File 'lib/sysdo/event_source.rb', line 14 def listen @listener.(self) # TODO: what if this dies? end |