1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Improve observers documentation

This commit is contained in:
Oscar Del Ben 2012-04-18 15:23:06 +02:00
parent 3333fe283c
commit 7536731a9a

View file

@ -214,6 +214,7 @@ module ActiveModel
end
# Start observing the declared classes and their subclasses.
# Called automatically by the instance method.
def initialize
observed_classes.each { |klass| add_observer!(klass) }
end
@ -242,6 +243,7 @@ module ActiveModel
klass.add_observer(self)
end
# Returns true if notifications are disabled for this object.
def disabled_for?(object)
klass = object.class
return false unless klass.respond_to?(:observers)