Class: Yoda::Instrument::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/yoda/instrument.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instrument:, name:, callback:) ⇒ Subscription

Returns a new instance of Subscription.

Parameters:



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)

Returns:



14
15
16
# File 'lib/yoda/instrument.rb', line 14

def callback
  @callback
end

#instrumentInstrument (readonly)

Returns:



8
9
10
# File 'lib/yoda/instrument.rb', line 8

def instrument
  @instrument
end

#nameString (readonly)

Returns:

  • (String)


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

#unsubscribeObject



25
26
27
# File 'lib/yoda/instrument.rb', line 25

def unsubscribe
  instrument.unsubscribe(self)
end