aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib
diff options
context:
space:
mode:
authorNicholas Rowe <nixterrimus@gmail.com>2011-02-20 21:05:41 -0500
committerNicholas Rowe <nixterrimus@gmail.com>2011-02-20 21:05:41 -0500
commit6d7a8267b98b0ffc5f1b45c0a35ba0548f2084e8 (patch)
tree34d7e088e26bdf7f21d4b11fa11bcdc4d3637c71 /activemodel/lib
parent2a75c190d43dc6ea9d43216d324b7c0f38a1c65d (diff)
downloadrails-6d7a8267b98b0ffc5f1b45c0a35ba0548f2084e8.tar.gz
rails-6d7a8267b98b0ffc5f1b45c0a35ba0548f2084e8.tar.bz2
rails-6d7a8267b98b0ffc5f1b45c0a35ba0548f2084e8.zip
Documentation: Added small comments to Observering module
Diffstat (limited to 'activemodel/lib')
-rw-r--r--activemodel/lib/active_model/observing.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activemodel/lib/active_model/observing.rb b/activemodel/lib/active_model/observing.rb
index dde3a882cf..f09bdca9d1 100644
--- a/activemodel/lib/active_model/observing.rb
+++ b/activemodel/lib/active_model/observing.rb
@@ -48,6 +48,7 @@ module ActiveModel
observers.each { |o| instantiate_observer(o) }
end
+ # Add a new Observer to the pool
def add_observer(observer)
unless observer.respond_to? :update
raise ArgumentError, "observer needs to respond to `update'"
@@ -55,12 +56,14 @@ module ActiveModel
observer_instances << observer
end
+ # Notify list of observers of a change
def notify_observers(*arg)
for observer in observer_instances
observer.update(*arg)
end
end
+ # Total number of observers
def count_observers
observer_instances.size
end