diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-11-06 13:53:52 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-11-06 13:53:52 -0800 |
commit | 9a4adb4b05dafa9d61ec88acdd089b79585ce10e (patch) | |
tree | 384d21c1aa6cf330b6387dbbd0d6085a74f516f0 /actionpack/lib | |
parent | 697acc40253b360a86c358cbdd928f38cedd6883 (diff) | |
download | rails-9a4adb4b05dafa9d61ec88acdd089b79585ce10e.tar.gz rails-9a4adb4b05dafa9d61ec88acdd089b79585ce10e.tar.bz2 rails-9a4adb4b05dafa9d61ec88acdd089b79585ce10e.zip |
use slice to avoid range allocation
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 4 |
1 files changed, 3 insertions, 1 deletions
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 |