Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

PERF: Hash[] + map is faster than this silly inject, and var[1..-1] i…

…s faster than var.sub('@', '')
  • Loading branch information...
commit c28bebef13b8a0e497fc7bbb83f542e9400e07e5 1 parent f656796
@spastorino spastorino authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 actionpack/lib/action_view/test_case.rb
View
6 actionpack/lib/action_view/test_case.rb
@@ -200,9 +200,9 @@ def _user_defined_ivars
# 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
Please sign in to comment.
Something went wrong with that request. Please try again.