Class: Yoda::Instrument::Subscription
- Inherits:
-
Object
- Object
- Yoda::Instrument::Subscription
- Defined in:
- lib/yoda/instrument.rb
Instance Attribute Summary collapse
- #callback ⇒ #call readonly
- #instrument ⇒ Instrument readonly
- #name ⇒ String readonly
Instance Method Summary collapse
- #call(*params, **kwargs) ⇒ Object
-
#initialize(instrument:, name:, callback:) ⇒ Subscription
constructor
A new instance of Subscription.
- #unsubscribe ⇒ Object
Constructor Details
#initialize(instrument:, name:, callback:) ⇒ Subscription
Returns a new instance of Subscription.
19 20 21 22 23 |
# File 'lib/yoda/instrument.rb', line 19 def initialize(instrument:, name:, callback:) @instrument = instrument @name = name @callback = callback end |
Instance Attribute Details
#callback ⇒ #call (readonly)
14 15 16 |
# File 'lib/yoda/instrument.rb', line 14 def callback @callback end |
#instrument ⇒ Instrument (readonly)
8 9 10 |
# File 'lib/yoda/instrument.rb', line 8 def instrument @instrument end |
#name ⇒ String (readonly)
11 12 13 |
# File 'lib/yoda/instrument.rb', line 11 def name @name end |
Instance Method Details
#call(*params, **kwargs) ⇒ Object
29 30 31 |
# File 'lib/yoda/instrument.rb', line 29 def call(*params, **kwargs) callback.call(*params, **kwargs) end |
#unsubscribe ⇒ Object
25 26 27 |
# File 'lib/yoda/instrument.rb', line 25 def unsubscribe instrument.unsubscribe(self) end |