fix for uniq with OrderedHash for Ruby 1.8.6
This commit is contained in:
parent
5168692ab9
commit
9c68d1c0ab
|
@ -111,5 +111,23 @@ class OrderedHash < Hash
|
||||||
super
|
super
|
||||||
@ordered_keys = []
|
@ordered_keys = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hash
|
||||||
|
code = 17
|
||||||
|
each_pair do |key, value|
|
||||||
|
code = 37 * code + key.hash
|
||||||
|
code = 37 * code + value.hash
|
||||||
|
end
|
||||||
|
code
|
||||||
|
end
|
||||||
|
|
||||||
|
def eql?(o)
|
||||||
|
if o.instance_of? OrderedHash
|
||||||
|
self.hash == o.hash
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue