Skip to content
Browse files

extract array to a constant

  • Loading branch information...
1 parent fae07a8 commit d46cf353d6cd9aaaa69c72599bef3ea43977a610 @vipulnsward vipulnsward committed Apr 22, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 activesupport/lib/active_support/callbacks.rb
View
4 activesupport/lib/active_support/callbacks.rb
@@ -61,6 +61,8 @@ module Callbacks
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 @@ def __callback_runner_name(kind)
# 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

0 comments on commit d46cf35

Please sign in to comment.
Something went wrong with that request. Please try again.