OrderedHash#each returns self not ordered_keys

This commit is contained in:
Les Hill 2009-10-02 11:43:57 +08:00 committed by Mike Dirolf
parent 79e76be9df
commit 454bb440e4
2 changed files with 3 additions and 0 deletions

View File

@ -67,6 +67,7 @@ class OrderedHash < Hash
def each
@ordered_keys ||= []
@ordered_keys.each { |k| yield k, self[k] }
self
end
def values

View File

@ -72,6 +72,8 @@ class OrderedHashTest < Test::Unit::TestCase
@oh['z'] = 42
assert_equal keys, @oh.keys
assert_equal @oh, @oh.each {|k,v|}
end
def test_values