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