Method: Rx::CompositeSubscription#push
- Defined in:
- lib/rx/subscriptions/composite_subscription.rb
#push(subscription) ⇒ Object Also known as: <<
Adds a subscription to the CompositeSubscription or unsubscribes the subscription if the CompositeSubscription is unsubscribed.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rx/subscriptions/composite_subscription.rb', line 47 def push(subscription) should_unsubscribe = false @gate.synchronize do should_unsubscribe = @unsubscribed unless @unsubscribed @subscriptions.push(subscription) @length += 1 end end subscription.unsubscribe if should_unsubscribe return self end |