RUBY-287
This commit is contained in:
parent
4f4e6ee833
commit
20d916bf98
|
@ -67,11 +67,10 @@ module BSON
|
|||
end
|
||||
|
||||
def keys
|
||||
@ordered_keys# || []
|
||||
@ordered_keys.dup
|
||||
end
|
||||
|
||||
def []=(key, value)
|
||||
#@ordered_keys ||= []
|
||||
unless has_key?(key)
|
||||
@ordered_keys << key
|
||||
end
|
||||
|
@ -79,14 +78,12 @@ module BSON
|
|||
end
|
||||
|
||||
def each
|
||||
#@ordered_keys ||= []
|
||||
@ordered_keys.each { |k| yield k, self[k] }
|
||||
self
|
||||
end
|
||||
alias :each_pair :each
|
||||
|
||||
def to_a
|
||||
#@ordered_keys ||= []
|
||||
@ordered_keys.map { |k| [k, self[k]] }
|
||||
end
|
||||
|
||||
|
@ -95,7 +92,7 @@ module BSON
|
|||
end
|
||||
|
||||
def replace(other)
|
||||
@ordered_keys = other.keys
|
||||
@ordered_keys.replace(other.keys)
|
||||
super
|
||||
end
|
||||
|
||||
|
@ -106,7 +103,6 @@ module BSON
|
|||
end
|
||||
|
||||
def merge!(other)
|
||||
#@ordered_keys ||= []
|
||||
@ordered_keys += other.keys # unordered if not an BSON::OrderedHash
|
||||
@ordered_keys.uniq!
|
||||
super(other)
|
||||
|
@ -116,7 +112,6 @@ module BSON
|
|||
|
||||
def dup
|
||||
result = OrderedHash.new
|
||||
#@ordered_keys ||= []
|
||||
@ordered_keys.each do |key|
|
||||
result[key] = self[key]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue