mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
copy-edits 6d7a826
This commit is contained in:
parent
843a5b9a3a
commit
9297027e08
1 changed files with 3 additions and 3 deletions
|
@ -48,7 +48,7 @@ module ActiveModel
|
||||||
observers.each { |o| instantiate_observer(o) }
|
observers.each { |o| instantiate_observer(o) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add a new Observer to the pool
|
# Add a new observer to the pool.
|
||||||
def add_observer(observer)
|
def add_observer(observer)
|
||||||
unless observer.respond_to? :update
|
unless observer.respond_to? :update
|
||||||
raise ArgumentError, "observer needs to respond to `update'"
|
raise ArgumentError, "observer needs to respond to `update'"
|
||||||
|
@ -56,14 +56,14 @@ module ActiveModel
|
||||||
observer_instances << observer
|
observer_instances << observer
|
||||||
end
|
end
|
||||||
|
|
||||||
# Notify list of observers of a change
|
# Notify list of observers of a change.
|
||||||
def notify_observers(*arg)
|
def notify_observers(*arg)
|
||||||
for observer in observer_instances
|
for observer in observer_instances
|
||||||
observer.update(*arg)
|
observer.update(*arg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Total number of observers
|
# Total number of observers.
|
||||||
def count_observers
|
def count_observers
|
||||||
observer_instances.size
|
observer_instances.size
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue