mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
PERF: Hash[] + map is faster than this silly inject, and var[1..-1] is faster than var.sub('@', '')
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user