File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
activesupport/lib/active_support/core_ext/object Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,11 @@ def as_json(options = nil) # :nodoc:
164
164
165
165
class Array
166
166
def as_json ( options = nil ) # :nodoc:
167
- map { |v | options ? v . as_json ( options . dup ) : v . as_json }
167
+ if options
168
+ map { |v | v . as_json ( options . dup ) }
169
+ else
170
+ map { |v | v . as_json }
171
+ end
168
172
end
169
173
end
170
174
@@ -184,8 +188,10 @@ def as_json(options = nil) # :nodoc:
184
188
end
185
189
186
190
result = { }
187
- subset . each do |k , v |
188
- result [ k . to_s ] = options ? v . as_json ( options . dup ) : v . as_json
191
+ if options
192
+ subset . each { |k , v | result [ k . to_s ] = v . as_json ( options . dup ) }
193
+ else
194
+ subset . each { |k , v | result [ k . to_s ] = v . as_json }
189
195
end
190
196
result
191
197
end
You can’t perform that action at this time.
0 commit comments