mirror of https://github.com/rails/rails
Reduce number of created objects in Hash#as_json
This commit is contained in:
parent
3eab31c487
commit
9256ae8a38
|
@ -169,7 +169,11 @@ class Hash
|
|||
self
|
||||
end
|
||||
|
||||
Hash[subset.map { |k, v| [k.to_s, options ? v.as_json(options.dup) : v.as_json] }]
|
||||
result = {}
|
||||
subset.each do |k, v|
|
||||
result[k.to_s] = options ? v.as_json(options.dup) : v.as_json
|
||||
end
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue