only dup the options once, the Callback object does not mutate them
This commit is contained in:
parent
132db318b3
commit
dd03f10d52
@ -585,7 +585,7 @@ 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]
|
||||
[type, filters, options.dup]
|
||||
end
|
||||
|
||||
# This is used internally to append, prepend and skip callbacks to the
|
||||
@ -636,7 +636,7 @@ def set_callback(name, *filter_list, &block)
|
||||
type, filters, options = normalize_callback_params(name, filter_list, block)
|
||||
self_chain = get_callbacks name
|
||||
mapped = filters.map do |filter|
|
||||
Callback.build(self_chain, filter, type, options.dup)
|
||||
Callback.build(self_chain, filter, type, options)
|
||||
end
|
||||
|
||||
__update_callbacks(name) do |target, chain|
|
||||
|
Loading…
Reference in New Issue
Block a user