From f888448ed289fd7b32c30e48ff3c3b9334ed1d22 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Tue, 7 Oct 2014 19:55:42 +0900 Subject: [PATCH] Reduce object allocation --- actionview/lib/action_view/template.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index 379f31bdaf..79a511f800 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -313,7 +313,7 @@ module ActionView def locals_code #:nodoc: # Double assign to suppress the dreaded 'assigned but unused variable' warning - @locals.map { |key| "#{key} = #{key} = local_assigns[:#{key}];" }.join + @locals.each_with_object('') { |key, code| code << "#{key} = #{key} = local_assigns[:#{key}];" } end def method_name #:nodoc: