Class: Rx::OnErrorNotification

Inherits:
Object
  • Object
show all
Includes:
Notification
Defined in:
lib/rx/core/notification.rb

Overview

Represents an on_error notification to an observer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Notification

create_on_completed, create_on_error, create_on_next, #has_value?, #on_completed?, #on_error?, #on_next?, #to_observable

Constructor Details

#initialize(error) ⇒ OnErrorNotification

Returns a new instance of OnErrorNotification.



116
117
118
119
# File 'lib/rx/core/notification.rb', line 116

def initialize(error)
  @error = error
  @kind = :on_error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



114
115
116
# File 'lib/rx/core/notification.rb', line 114

def error
  @error
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



121
122
123
# File 'lib/rx/core/notification.rb', line 121

def ==(other)
  other.class == self.class && other.on_error? && error == other.error
end

#accept(observer) ⇒ Object

Invokes the observer’s method corresponding to the notification.



131
132
133
# File 'lib/rx/core/notification.rb', line 131

def accept(observer)
  observer.on_error error
end

#to_sObject



126
127
128
# File 'lib/rx/core/notification.rb', line 126

def to_s
  "on_error(#{error})"
end