module RxRuby::Notification
Represents a notification to an observer.
Public Class Methods
create_on_completed()
click to toggle source
Creates an object that represents an on_completed notification to an observer.
# File lib/rx_ruby/core/notification.rb, line 40 def create_on_completed OnCompletedNotification.new end
create_on_error(error)
click to toggle source
Creates an object that represents an on_error notification to an observer.
# File lib/rx_ruby/core/notification.rb, line 35 def create_on_error(error) OnErrorNotification.new error end
create_on_next(value)
click to toggle source
Creates an object that represents an on_next notification to an observer.
# File lib/rx_ruby/core/notification.rb, line 30 def create_on_next(value) OnNextNotification.new value end
Public Instance Methods
has_value?()
click to toggle source
Determines whether this notification has a value.
# File lib/rx_ruby/core/notification.rb, line 62 def has_value? false end
on_completed?()
click to toggle source
Determines whether this is an on_completed notification.
# File lib/rx_ruby/core/notification.rb, line 57 def on_completed? @kind == :on_completed end
on_error?()
click to toggle source
Determines whether this is an on_error notification.
# File lib/rx_ruby/core/notification.rb, line 52 def on_error? @kind == :on_error end
on_next?()
click to toggle source
Determines whether this is an on_next notification.
# File lib/rx_ruby/core/notification.rb, line 47 def on_next? @kind == :on_next end
to_observable(scheduler = ImmediateScheduler.instance)
click to toggle source
Returns an observable sequence with a single notification.
# File lib/rx_ruby/core/notification.rb, line 67 def to_observable(scheduler = ImmediateScheduler.instance) AnonymousObservable.new do |observer| scheduler.schedule lambda { accept observer observer.on_completed if on_next? } end end