diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-10-03 13:34:34 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-10-03 13:34:34 -0200 |
commit | c28bebef13b8a0e497fc7bbb83f542e9400e07e5 (patch) | |
tree | 64736de37a17be0a5ba4a6f5dfff190fa67cf492 | |
parent | f656796d05715174568536cfe119a3959a020f23 (diff) | |
download | rails-c28bebef13b8a0e497fc7bbb83f542e9400e07e5.tar.gz rails-c28bebef13b8a0e497fc7bbb83f542e9400e07e5.tar.bz2 rails-c28bebef13b8a0e497fc7bbb83f542e9400e07e5.zip |
PERF: Hash[] + map is faster than this silly inject, and var[1..-1] is faster than var.sub('@', '')
-rw-r--r-- | actionpack/lib/action_view/test_case.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index ac59c16d7c..731f91df30 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -200,9 +200,9 @@ module ActionView # rendered. This is generally intended for internal use and extension # frameworks. def view_assigns - _user_defined_ivars.inject({}) do |hash, var| - hash.merge(var.sub('@','').to_sym => instance_variable_get(var)) - end + Hash[_user_defined_ivars.map do |var| + [var[1..-1].to_sym, instance_variable_get(var)] + end] end def _assigns |