Skip to content
Browse files

Documentation: Added small comments to Observering module

  • Loading branch information...
1 parent 2a75c19 commit 6d7a8267b98b0ffc5f1b45c0a35ba0548f2084e8 @nixterrimus nixterrimus committed Feb 20, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 activemodel/lib/active_model/observing.rb
View
3 activemodel/lib/active_model/observing.rb
@@ -48,19 +48,22 @@ def instantiate_observers
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'"
end
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

0 comments on commit 6d7a826

Please sign in to comment.
Something went wrong with that request. Please try again.