aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-05-13 14:11:09 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-13 14:11:09 -0700
commit35c4a2ca95848bf03839ebb58a98d93189c5d3aa (patch)
tree8a3272784401b146868217d9cff29e947790cbeb /activesupport
parent0b9b132e3293c56fb37a612c51a883df26a2b6c7 (diff)
downloadrails-35c4a2ca95848bf03839ebb58a98d93189c5d3aa.tar.gz
rails-35c4a2ca95848bf03839ebb58a98d93189c5d3aa.tar.bz2
rails-35c4a2ca95848bf03839ebb58a98d93189c5d3aa.zip
extract callback param munging
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/callbacks.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index 92b57ee1ce..cc0fe51598 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -437,12 +437,17 @@ module ActiveSupport
__callback_runner_name_cache[kind]
end
- # This is used internally to append, prepend and skip callbacks to the
- # CallbackChain.
- def __update_callbacks(name, filters, block) #:nodoc:
+ def normalize_callback_params(name, filters, block) # :nodoc:
type = CALLBACK_FILTER_TYPES.include?(filters.first) ? filters.shift : :before
options = filters.last.is_a?(Hash) ? filters.pop : {}
filters.unshift(block) if block
+ [type, filters, options]
+ end
+
+ # This is used internally to append, prepend and skip callbacks to the
+ # CallbackChain.
+ def __update_callbacks(name, filters, block) #:nodoc:
+ type, filters, options = normalize_callback_params(name, filters, block)
([self] + ActiveSupport::DescendantsTracker.descendants(self)).reverse.each do |target|
chain = target.send("_#{name}_callbacks")