Class: Rx::ObserverConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/rx/core/observer.rb

Overview

Configuration class for storing Observer actions

Constant Summary collapse

DEFAULT_ON_NEXT =
lambda {|x| }
DEFAULT_ON_ERROR =
lambda {|error| raise error }
DEFAULT_ON_COMPLETED =
lambda { }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeObserverConfiguration

Returns a new instance of ObserverConfiguration.



14
15
16
17
18
# File 'lib/rx/core/observer.rb', line 14

def initialize
  @on_next_action = DEFAULT_ON_NEXT
  @on_error_action = DEFAULT_ON_ERROR
  @on_completed_action = DEFAULT_ON_COMPLETED
end

Instance Attribute Details

#on_completed_actionObject (readonly)

Returns the value of attribute on_completed_action.



12
13
14
# File 'lib/rx/core/observer.rb', line 12

def on_completed_action
  @on_completed_action
end

#on_error_actionObject (readonly)

Returns the value of attribute on_error_action.



12
13
14
# File 'lib/rx/core/observer.rb', line 12

def on_error_action
  @on_error_action
end

#on_next_actionObject (readonly)

Returns the value of attribute on_next_action.



12
13
14
# File 'lib/rx/core/observer.rb', line 12

def on_next_action
  @on_next_action
end

Instance Method Details

#on_completed(&on_completed_action) ⇒ Object



28
29
30
# File 'lib/rx/core/observer.rb', line 28

def on_completed(&on_completed_action)
  @on_completed_action = on_completed_action
end

#on_error(&on_error_action) ⇒ Object



24
25
26
# File 'lib/rx/core/observer.rb', line 24

def on_error(&on_error_action)
  @on_error_action = on_error_action
end

#on_next(&on_next_action) ⇒ Object



20
21
22
# File 'lib/rx/core/observer.rb', line 20

def on_next(&on_next_action)
  @on_next_action = on_next_action
end