minor: remove unused code in OrderedHash

This commit is contained in:
Kyle Banker 2011-04-01 12:26:56 -04:00
parent 1d3ffe37c7
commit 113eeb4254
1 changed files with 6 additions and 6 deletions

View File

@ -62,11 +62,11 @@ module BSON
end end
def keys def keys
@ordered_keys || [] @ordered_keys# || []
end end
def []=(key, value) def []=(key, value)
@ordered_keys ||= [] #@ordered_keys ||= []
unless has_key?(key) unless has_key?(key)
@ordered_keys << key @ordered_keys << key
end end
@ -74,14 +74,14 @@ module BSON
end end
def each def each
@ordered_keys ||= [] #@ordered_keys ||= []
@ordered_keys.each { |k| yield k, self[k] } @ordered_keys.each { |k| yield k, self[k] }
self self
end end
alias :each_pair :each alias :each_pair :each
def to_a def to_a
@ordered_keys ||= [] #@ordered_keys ||= []
@ordered_keys.map { |k| [k, self[k]] } @ordered_keys.map { |k| [k, self[k]] }
end end
@ -96,7 +96,7 @@ module BSON
end end
def merge!(other) def merge!(other)
@ordered_keys ||= [] #@ordered_keys ||= []
@ordered_keys += other.keys # unordered if not an BSON::OrderedHash @ordered_keys += other.keys # unordered if not an BSON::OrderedHash
@ordered_keys.uniq! @ordered_keys.uniq!
super(other) super(other)
@ -106,7 +106,7 @@ module BSON
def dup def dup
result = OrderedHash.new result = OrderedHash.new
@ordered_keys ||= [] #@ordered_keys ||= []
@ordered_keys.each do |key| @ordered_keys.each do |key|
result[key] = self[key] result[key] = self[key]
end end