提交 697f4851 编写于 作者: J James A. Rosen 提交者: Santiago Pastorino

OrderedHash#select now preserves order [#5843 state:resolved]

Signed-off-by: NSantiago Pastorino <santiago@wyeworks.com>
上级 990f52eb
......@@ -137,6 +137,8 @@ def each
alias_method :each_pair, :each
alias_method :select, :find_all
def clear
super
@keys.clear
......
......@@ -109,6 +109,14 @@ def test_each_pair
assert_equal @keys, keys
end
def test_find_all
assert_equal @keys, @ordered_hash.find_all { true }.map(&:first)
end
def test_select
assert_equal @keys, @ordered_hash.select { true }.map(&:first)
end
def test_delete_if
copy = @ordered_hash.dup
copy.delete('pink')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册