Permalink
Browse files

use slice to avoid range allocation

  • Loading branch information...
1 parent 697acc4 commit 9a4adb4b05dafa9d61ec88acdd089b79585ce10e @tenderlove tenderlove committed Nov 6, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 actionpack/lib/abstract_controller/rendering.rb
@@ -69,7 +69,9 @@ def view_assigns
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

0 comments on commit 9a4adb4

Please sign in to comment.