From 9a4adb4b05dafa9d61ec88acdd089b79585ce10e Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 6 Nov 2013 13:53:52 -0800 Subject: use slice to avoid range allocation --- actionpack/lib/abstract_controller/rendering.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index a4ce7676f0..1e30593af1 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -69,7 +69,9 @@ module AbstractController variables = instance_variables variables -= protected_instance_variables variables -= DEFAULT_PROTECTED_INSTANCE_VARIABLES - variables.each { |name| hash[name[1..-1]] = instance_variable_get(name) } + variables.each { |name| + hash[name.slice(1, name.length)] = instance_variable_get(name) + } hash end -- cgit v1.2.3