From cbac1fdf65286d7042ab263ce8a3af5d6022d3af Mon Sep 17 00:00:00 2001 From: eileencodes Date: Thu, 5 Mar 2015 15:30:39 -0500 Subject: 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`. --- activesupport/lib/active_support/callbacks.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'activesupport/lib/active_support/callbacks.rb') 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 -- cgit v1.2.3