Class: Reactive::Observable::Merge::Observer

Inherits:
Reactive::ObserverWrapper show all
Defined in:
lib/Reactive/observable/merge.rb

Instance Attribute Summary collapse

Attributes inherited from Reactive::ObserverWrapper

#parent, #target

Instance Method Summary collapse

Methods inherited from Reactive::ObserverWrapper

#active?, #attributes, #on_next, #unwrap, #unwrap_parent, #wrap_with_parent

Constructor Details

#initialize(*args) ⇒ Observer

Returns a new instance of Observer.



8
9
10
11
# File 'lib/Reactive/observable/merge.rb', line 8

def initialize(*args)
  @num_completed = 0
  super
end

Instance Attribute Details

#num_completedObject

Returns the value of attribute num_completed.



6
7
8
# File 'lib/Reactive/observable/merge.rb', line 6

def num_completed
  @num_completed
end

Instance Method Details

#on_completeObject



13
14
15
16
17
18
19
20
# File 'lib/Reactive/observable/merge.rb', line 13

def on_complete
  if num_completed == 0
    self.num_completed = 1
  else
    self.target.on_complete
    unwrap
  end
end