Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a little bit more docs on ObserverArray

  • Loading branch information...
commit 505108b86976bf71091a772910a80c0722776139 1 parent 533efd8
@smartinez87 authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 activemodel/lib/active_model/observer_array.rb
View
6 activemodel/lib/active_model/observer_array.rb
@@ -13,10 +13,12 @@ def self.for(model_class)
INSTANCES[model_class]
end
- # returns false if:
+ # Returns false if:
# - the ObserverArray for the given model's class has the given observer
# in its disabled_observers set.
# - or that is the case at any level of the model's superclass chain.
+ #
+ # On other cases it returns true, since observers are enabled by default.
def self.observer_enabled?(observer, model)
klass = model.class
observer_class = observer.class
@@ -40,10 +42,12 @@ def initialize(model_class, *args)
super(*args)
end
+ # Disable the given observers.
def disable(*observers, &block)
set_enablement(false, observers, &block)
end
+ # Enable the given observers.
def enable(*observers, &block)
set_enablement(true, observers, &block)
end
Please sign in to comment.
Something went wrong with that request. Please try again.