class RxRuby::ScheduledDisposable

Represents a disposable resource whose disposal invocation will be scheduled on the specified scheduler

Attributes

scheduler[R]
subscription[R]

Public Class Methods

new(scheduler, subscription) click to toggle source
# File lib/rx_ruby/subscriptions/scheduled_subscription.rb, line 9
def initialize(scheduler, subscription)
  raise 'disposable cannot be nil' unless subscription
  raise 'scheduler cannot be nil' unless scheduler

  @scheduler = scheduler
  @subscription = subscription
end

Public Instance Methods

unsubscribe() click to toggle source

Unsubscribes the wrapped subscription on the provided scheduler.

# File lib/rx_ruby/subscriptions/scheduled_subscription.rb, line 23
def unsubscribe
  @scheduler.schedule lambda do
    unless @subscription.nil?
      @subscription.unsubscribe
      @subscription = nil
    end
  end
end
unsubscribed?() click to toggle source

Gets a value that indicates whether the object is unsubscribed.

# File lib/rx_ruby/subscriptions/scheduled_subscription.rb, line 18
def unsubscribed?
  @subscription.nil?
end