Class: Reacto::Subscriptions::CombiningLastSubscription

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

Instance Method Summary collapse

Methods inherited from CompositeSubscription

#add, #add_resource, #closed?, #initialize, #on_error, #on_open, #on_value, #on_value_subscriptions, #subscription!, #unsubscribe, #waiting?

Methods included from Subscription

#add, #add_resource, #unsubscribe

Constructor Details

This class inherits a constructor from Reacto::Subscriptions::CompositeSubscription

Instance Method Details

#after_on_value(_) ⇒ Object



11
12
13
14
# File 'lib/reacto/subscriptions/combining_last_subscription.rb', line 11

def after_on_value(_)
  return if @subscriptions.map(&:last_value).any? { |vl| vl == NO_VALUE }
  @subscriptions.each { |sub| sub.last_value = NO_VALUE }
end

#on_closeObject



16
17
18
19
# File 'lib/reacto/subscriptions/combining_last_subscription.rb', line 16

def on_close
  return unless subscribed?
  @subscriber.on_close
end

#subscribed?Boolean

Returns:

  • (Boolean)


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

def subscribed?
  @subscriptions.all? { |s| s.subscribed? }
end