Skip to content

Commit 53f442b

Browse files
author
Uddhava
committed
Replaced OrderedHash usage with Ruby 1.9 Hash
1 parent a8e9f29 commit 53f442b

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

activesupport/lib/active_support/json/encoding.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require 'active_support/core_ext/object/to_json'
22
require 'active_support/core_ext/module/delegation'
33
require 'active_support/json/variable'
4-
require 'active_support/ordered_hash'
54

65
require 'bigdecimal'
76
require 'active_support/core_ext/big_decimal/conversions' # for #to_s
@@ -239,8 +238,7 @@ def as_json(options = nil) #:nodoc:
239238

240239
# use encoder as a proxy to call as_json on all values in the subset, to protect from circular references
241240
encoder = options && options[:encoder] || ActiveSupport::JSON::Encoding::Encoder.new(options)
242-
result = self.is_a?(ActiveSupport::OrderedHash) ? ActiveSupport::OrderedHash : Hash
243-
result[subset.map { |k, v| [k.to_s, encoder.as_json(v, options)] }]
241+
Hash[subset.map { |k, v| [k.to_s, encoder.as_json(v, options)] }]
244242
end
245243

246244
def encode_json(encoder)

0 commit comments

Comments
 (0)