Class: Rx::OnNextNotification

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

Overview

Represents an on_next 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, #on_completed?, #on_error?, #on_next?, #to_observable

Constructor Details

#initialize(value) ⇒ OnNextNotification

Returns a new instance of OnNextNotification.



84
85
86
87
# File 'lib/rx/core/notification.rb', line 84

def initialize(value)
  @value = value
  @kind = :on_next
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



82
83
84
# File 'lib/rx/core/notification.rb', line 82

def value
  @value
end

Instance Method Details

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



94
95
96
# File 'lib/rx/core/notification.rb', line 94

def ==(other)
  other.class == self.class && other.on_next? && value == other.value
end

#accept(observer) ⇒ Object

Invokes the observer’s method corresponding to the notification.



104
105
106
# File 'lib/rx/core/notification.rb', line 104

def accept(observer)
  observer.on_next value
end

#has_value?Boolean

Determines whether this notification has a value.

Returns:

  • (Boolean)


90
91
92
# File 'lib/rx/core/notification.rb', line 90

def has_value?
  true
end

#to_sObject



99
100
101
# File 'lib/rx/core/notification.rb', line 99

def to_s
  "on_next(#{value})"
end