OrderedHash#each returns self not ordered_keys
This commit is contained in:
parent
79e76be9df
commit
454bb440e4
|
@ -67,6 +67,7 @@ class OrderedHash < Hash
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
||||||
def values
|
def values
|
||||||
|
|
|
@ -72,6 +72,8 @@ class OrderedHashTest < Test::Unit::TestCase
|
||||||
|
|
||||||
@oh['z'] = 42
|
@oh['z'] = 42
|
||||||
assert_equal keys, @oh.keys
|
assert_equal keys, @oh.keys
|
||||||
|
|
||||||
|
assert_equal @oh, @oh.each {|k,v|}
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_values
|
def test_values
|
||||||
|
|
Loading…
Reference in New Issue