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) ⇒ 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.
16 17 18 19 20 |
# File 'lib/yoda/instrument.rb', line 16 def initialize(instrument:, name:, callback:) @instrument = instrument @name = name @callback = callback end |
Instance Attribute Details
#callback ⇒ #call (readonly)
11 12 13 |
# File 'lib/yoda/instrument.rb', line 11 def callback @callback end |
#instrument ⇒ Instrument (readonly)
5 6 7 |
# File 'lib/yoda/instrument.rb', line 5 def instrument @instrument end |
#name ⇒ String (readonly)
8 9 10 |
# File 'lib/yoda/instrument.rb', line 8 def name @name end |
Instance Method Details
#call(params) ⇒ Object
26 27 28 |
# File 'lib/yoda/instrument.rb', line 26 def call(params) callback.call(params) end |
#unsubscribe ⇒ Object
22 23 24 |
# File 'lib/yoda/instrument.rb', line 22 def unsubscribe instrument.unsubscribe(self) end |