Make internal callback model definitions private in AMo
These _define class methods don't need to be exposed to objects that extend ActiveModel::Callbacks. Also use merge! options to avoid the creation of an extra hash.
This commit is contained in:
parent
24a4cc741a
commit
2a7cfee13e
|
@ -89,11 +89,11 @@ module ActiveModel
|
|||
def define_model_callbacks(*callbacks)
|
||||
options = callbacks.extract_options!
|
||||
options = {
|
||||
:terminator => "result == false",
|
||||
:skip_after_callbacks_if_terminated => true,
|
||||
:scope => [:kind, :name],
|
||||
:only => [:before, :around, :after]
|
||||
}.merge(options)
|
||||
:terminator => "result == false",
|
||||
:skip_after_callbacks_if_terminated => true,
|
||||
:scope => [:kind, :name],
|
||||
:only => [:before, :around, :after]
|
||||
}.merge!(options)
|
||||
|
||||
types = Array(options.delete(:only))
|
||||
|
||||
|
@ -106,6 +106,8 @@ module ActiveModel
|
|||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def _define_before_model_callback(klass, callback) #:nodoc:
|
||||
klass.class_eval <<-CALLBACK, __FILE__, __LINE__ + 1
|
||||
def self.before_#{callback}(*args, &block)
|
||||
|
|
Loading…
Reference in New Issue