Skip to content

Commit b6d7506

Browse files
committed
added ad updated some YARD to observable
1 parent 2847116 commit b6d7506

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/concurrent/atomic/copy_on_notify_observer_set.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ def initialize
1212
end
1313

1414
# Adds an observer to this set
15+
# If a block is passed, the observer will be created by this method and no other params should be passed
1516
# @param [Object] observer the observer to add
1617
# @param [Symbol] func the function to call on the observer during notification. Default is :update
17-
# @return [Symbol] the added function
18+
# @return [Object] the added observer
1819
def add_observer(observer=nil, func=:update, &block)
1920
if observer.nil? && block.nil?
2021
raise ArgumentError, 'should pass observer as a first argument or block'

lib/concurrent/atomic/copy_on_write_observer_set.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ def initialize
1111
end
1212

1313
# Adds an observer to this set
14+
# If a block is passed, the observer will be created by this method and no other params should be passed
1415
# @param [Object] observer the observer to add
1516
# @param [Symbol] func the function to call on the observer during notification. Default is :update
16-
# @return [Symbol] the added function
17+
# @return [Object] the added observer
1718
def add_observer(observer=nil, func=:update, &block)
1819
if observer.nil? && block.nil?
1920
raise ArgumentError, 'should pass observer as a first argument or block'

lib/concurrent/observable.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,23 @@ module Concurrent
55

66
module Observable
77

8+
# @return [Object] the added observer
89
def add_observer(*args, &block)
910
observers.add_observer(*args, &block)
1011
end
1112

13+
# @return [Object] the deleted observer
1214
def delete_observer(*args)
1315
observers.delete_observer(*args)
1416
end
1517

18+
# @return [Observable] self
1619
def delete_observers
1720
observers.delete_observers
1821
self
1922
end
2023

24+
# @return [Integer] the observers count
2125
def count_observers
2226
observers.count_observers
2327
end

0 commit comments

Comments
 (0)