Class: Rx::CheckedObserver
- Inherits:
-
Object
- Object
- Rx::CheckedObserver
show all
- Includes:
- Observer
- Defined in:
- lib/rx/core/checked_observer.rb
Instance Method Summary
collapse
Methods included from Observer
allow_reentrancy, #as_observer, #checked, configure, create, from_notifier, #notify_on, prevent_reentrancy, #to_notifier
Constructor Details
Returns a new instance of CheckedObserver.
19
20
21
22
|
# File 'lib/rx/core/checked_observer.rb', line 19
def initialize(observer)
@observer = observer
@state = :idle
end
|
Instance Method Details
#on_completed ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/rx/core/checked_observer.rb', line 42
def on_completed
check_access
begin
@observer.on_completed
ensure
Mutex.new.synchronize { @state = :done }
end
end
|
#on_error(error) ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/rx/core/checked_observer.rb', line 33
def on_error(error)
check_access
begin
@observer.on_error error
ensure
Mutex.new.synchronize { @state = :done }
end
end
|
#on_next(value) ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'lib/rx/core/checked_observer.rb', line 24
def on_next(value)
check_access
begin
@observer.on_next value
ensure
Mutex.new.synchronize { @state = :idle }
end
end
|