Class: AudioStream::AudioObservableLambda

Inherits:
Object
  • Object
show all
Includes:
AudioObservable, AudioObserver
Defined in:
lib/audio_stream/audio_observable_lambda.rb

Instance Method Summary collapse

Methods included from AudioObservable

#fx, #mono, #notify_complete, #notify_next, #send_to, #stereo, #subscribe, #subscribe_on_next

Methods included from AudioObserver

#update

Constructor Details

#initialize(&block) ⇒ AudioObservableLambda

Returns a new instance of AudioObservableLambda.



7
8
9
# File 'lib/audio_stream/audio_observable_lambda.rb', line 7

def initialize(&block)
  @block = block
end

Instance Method Details

#on_completeObject



16
17
18
# File 'lib/audio_stream/audio_observable_lambda.rb', line 16

def on_complete
  notify_complete
end

#on_next(input) ⇒ Object



11
12
13
14
# File 'lib/audio_stream/audio_observable_lambda.rb', line 11

def on_next(input)
  output = @block.call(input)
  notify_next(output)
end