we still need to define ==, even in 1.9

This commit is contained in:
Mike Dirolf 2009-03-23 11:51:35 -04:00
parent 6171b480d7
commit ac4dde5d76
1 changed files with 6 additions and 6 deletions

View File

@ -20,6 +20,12 @@
# Hash already keeps its keys ordered by order of insertion.
class OrderedHash < Hash
def ==(other)
!other.nil? &&
keys == other.keys &&
values == other.values
end
# We only need the body of this class if the RUBY_VERSION is before 1.9
if RUBY_VERSION < '1.9'
@ -35,12 +41,6 @@ class OrderedHash < Hash
super(key, value)
end
def ==(other)
!other.nil? &&
keys == other.keys &&
values == other.values
end
def each
@ordered_keys ||= []
@ordered_keys.each { |k| yield k, self[k] }