Class: Reacto::Subscriptions::FlatMapSubscription

Inherits:
CompositeSubscription show all
Defined in:
lib/reacto/subscriptions/flat_map_subscription.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CompositeSubscription

#add, #add_resource, #after_on_value, #closed?, #on_error, #on_open, #on_value, #subscribed?, #subscription!, #unsubscribe

Methods included from Subscription

#add, #add_resource, #subscribed?, #unsubscribe

Constructor Details

#initialize(subscriber) ⇒ FlatMapSubscription

Returns a new instance of FlatMapSubscription.



9
10
11
12
13
# File 'lib/reacto/subscriptions/flat_map_subscription.rb', line 9

def initialize(subscriber)
  super(nil, subscriber)

  @source_closed = false
end

Instance Attribute Details

#source_closedObject

Returns the value of attribute source_closed.



7
8
9
# File 'lib/reacto/subscriptions/flat_map_subscription.rb', line 7

def source_closed
  @source_closed
end

Instance Method Details

#on_closeObject



23
24
25
26
27
28
29
30
# File 'lib/reacto/subscriptions/flat_map_subscription.rb', line 23

def on_close
  return unless source_closed
  return unless subscribed?
  return unless @subscriptions.all? { |s| s.closed? }

  @subscriber.on_close
  unsubscribe
end

#on_value_subscriptions(v) ⇒ Object



19
20
21
# File 'lib/reacto/subscriptions/flat_map_subscription.rb', line 19

def on_value_subscriptions(v)
  @subscriber.on_value(v)
end

#waiting?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/reacto/subscriptions/flat_map_subscription.rb', line 15

def waiting?
  false
end