Class: Rx::Subject::AnonymousSubject

Inherits:
Object
  • Object
show all
Includes:
Observable, Observer
Defined in:
lib/rx/subjects/subject_extensions.rb

Instance Method Summary collapse

Methods included from Observer

allow_reentrancy, #as_observer, #checked, configure, create, from_notifier, #notify_on, prevent_reentrancy, #to_notifier

Methods included from Observable

#_subscribe, #add_ref, #all?, #amb, amb, #and, #any?, #as_observable, #average, #buffer_with_count, #buffer_with_time, case, combine_latest, #combine_latest, #concat, concat, #concat_all, #concat_map, #concat_map_observer, #contains, #contains?, #count, create, #debounce, #default_if_empty, defer, #delay, #delay_with_selector, #dematerialize, #distinct, #distinct_until_changed, #do, #element_at, #element_at_or_default, empty, #empty?, #ensures, #enumerator_repeat_infinitely, #enumerator_repeat_times, #final, #first, #first_or_default, #flat_map, #flat_map_with_index, for, fork_join, from, from_array, generate, #group_join, if, #ignore_elements, interval, just, #last, #last_or_default, #latest, #map, #map_with_index, #materialize, #max, #max_by, #merge, #merge_all, merge_all, merge_concurrent, #merge_concurrent, #min, #min_by, #multicast, never, #none?, #observe_on, of, of_array, of_enumerable, of_enumerator, on_error_resume_next, #on_error_resume_next, pairs, #pluck, #publish, raise_error, range, #reduce, repeat, #repeat, repeat_infinitely, #repeat_infinitely, rescue_error, #rescue_error, #retry, #retry_infinitely, #scan, #select, #select_with_index, #sequence_eql?, #single, #single_or_default, #skip, #skip_last, #skip_until, #skip_while, #skip_while_with_index, start, #start_with, #subscribe_on, #subscribe_on_completed, #subscribe_on_error, #subscribe_on_next, #sum, #synchronize, #take, #take_last, #take_last_buffer, #take_until, #take_while, #take_while_with_index, #tap, #time_interval, timer, #timestamp, #to_a, to_async, #to_h, using, when, while, #window_with_count, #window_with_time, #zip, zip

Constructor Details

#initialize(observer, observable) ⇒ AnonymousSubject

Returns a new instance of AnonymousSubject.



20
21
22
23
# File 'lib/rx/subjects/subject_extensions.rb', line 20

def initialize(observer, observable)
  @observer = observer
  @observable = observable
end

Instance Method Details

#on_completedObject



25
26
27
# File 'lib/rx/subjects/subject_extensions.rb', line 25

def on_completed
  @observer.on_completed
end

#on_error(error) ⇒ Object



29
30
31
32
# File 'lib/rx/subjects/subject_extensions.rb', line 29

def on_error(error)
  raise 'error cannot be nil' unless error
  @observer.on_error(error)
end

#on_next(value) ⇒ Object



34
35
36
# File 'lib/rx/subjects/subject_extensions.rb', line 34

def on_next(value)
  @observer.on_next(value)
end

#subscribe(observer) ⇒ Object



38
39
40
41
# File 'lib/rx/subjects/subject_extensions.rb', line 38

def subscribe(observer)
  raise 'observer cannot be nil' unless observer
  @observable.subscribe(observer)
end