aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/callbacks.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2015-03-05 15:30:39 -0500
committereileencodes <eileencodes@gmail.com>2015-03-05 18:21:16 -0500
commitcbac1fdf65286d7042ab263ce8a3af5d6022d3af (patch)
tree1526f820e5c44a75d9eac481eb741f2a25ad058b /activesupport/lib/active_support/callbacks.rb
parent5eaeb3708059aa23ed1c250219082c508e58c6e5 (diff)
downloadrails-cbac1fdf65286d7042ab263ce8a3af5d6022d3af.tar.gz
rails-cbac1fdf65286d7042ab263ce8a3af5d6022d3af.tar.bz2
rails-cbac1fdf65286d7042ab263ce8a3af5d6022d3af.zip
Change *args to arg in CallbackSequence#call
`CallbackSequence#call` can only ever take one argument. Using `*args` here produces unnecessary array allocations. Since it only ever takes one argument we should use `arg` instead of `*args`.
Diffstat (limited to 'activesupport/lib/active_support/callbacks.rb')
-rw-r--r--activesupport/lib/active_support/callbacks.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index f32bb8a0cc..37f9494272 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -490,17 +490,17 @@ module ActiveSupport
end
def around(&around)
- CallbackSequence.new do |*args|
- around.call(*args) {
- self.call(*args)
+ CallbackSequence.new do |arg|
+ around.call(arg) {
+ self.call(arg)
}
end
end
- def call(*args)
- @before.each { |b| b.call(*args) }
- value = @call.call(*args)
- @after.each { |a| a.call(*args) }
+ def call(arg)
+ @before.each { |b| b.call(arg) }
+ value = @call.call(arg)
+ @after.each { |a| a.call(arg) }
value
end
end