mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
PERF: Hash[] + map is faster than this silly inject, and var[1..-1] is faster than var.sub('@', '')
This commit is contained in:
parent
f656796d05
commit
c28bebef13
1 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue