Merge pull request #10293 from vipulnsward/dont_mutate_callback
extract array to a constant
This commit is contained in:
commit
95a2ccc011
@ -61,6 +61,8 @@ module Callbacks
|
|||||||
extend ActiveSupport::DescendantsTracker
|
extend ActiveSupport::DescendantsTracker
|
||||||
end
|
end
|
||||||
|
|
||||||
|
CALLBACK_FILTER_TYPES = [:before, :after, :around]
|
||||||
|
|
||||||
# Runs the callbacks for the given event.
|
# Runs the callbacks for the given event.
|
||||||
#
|
#
|
||||||
# Calls the before and around callbacks in the order they were set, yields
|
# 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
|
# This is used internally to append, prepend and skip callbacks to the
|
||||||
# CallbackChain.
|
# CallbackChain.
|
||||||
def __update_callbacks(name, filters = [], block = nil) #:nodoc:
|
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 : {}
|
options = filters.last.is_a?(Hash) ? filters.pop : {}
|
||||||
filters.unshift(block) if block
|
filters.unshift(block) if block
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user