diff options
author | Vipul A M <vipulnsward@gmail.com> | 2013-04-22 08:57:27 +0530 |
---|---|---|
committer | Vipul A M <vipulnsward@gmail.com> | 2013-04-22 08:57:27 +0530 |
commit | d46cf353d6cd9aaaa69c72599bef3ea43977a610 (patch) | |
tree | 8c9720fbf679480da9d1ba6235a34ead3762f9ab /activesupport | |
parent | fae07a81badb3067a3ebdd7d81aa22625186329e (diff) | |
download | rails-d46cf353d6cd9aaaa69c72599bef3ea43977a610.tar.gz rails-d46cf353d6cd9aaaa69c72599bef3ea43977a610.tar.bz2 rails-d46cf353d6cd9aaaa69c72599bef3ea43977a610.zip |
extract array to a constant
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/callbacks.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 6c0cae71ed..357d9adde3 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -61,6 +61,8 @@ module ActiveSupport extend ActiveSupport::DescendantsTracker end + CALLBACK_FILTER_TYPES = [:before, :after, :around] + # Runs the callbacks for the given event. # # Calls the before and around callbacks in the order they were set, yields @@ -396,7 +398,7 @@ module ActiveSupport # This is used internally to append, prepend and skip callbacks to the # CallbackChain. def __update_callbacks(name, filters = [], block = nil) #:nodoc: - type = [:before, :after, :around].include?(filters.first) ? filters.shift : :before + type = CALLBACK_FILTER_TYPES.include?(filters.first) ? filters.shift : :before options = filters.last.is_a?(Hash) ? filters.pop : {} filters.unshift(block) if block |