RUBY-359 Fix for OrderedHash on 1.8.7

This commit is contained in:
Kyle Banker 2011-11-15 12:43:29 -05:00
parent 6f57665631
commit 24b9653366
2 changed files with 6 additions and 3 deletions

View File

@ -130,11 +130,12 @@ module BSON
end
def delete_if(&block)
self.each do |k,v|
if yield k, v
delete(k)
keys.each do |key|
if yield key, self[key]
delete(key)
end
end
self
end
def reject(&block)

View File

@ -212,6 +212,8 @@ class OrderedHashTest < Test::Unit::TestCase
assert @oh.keys.include?('z')
@oh.delete_if { |k,v| k == 'z' }
assert !@oh.keys.include?('z')
@oh.delete_if { |k, v| v > 0 }
assert @oh.keys.empty?
end
def test_reject