RUBY-359 Fix for OrderedHash on 1.8.7
This commit is contained in:
parent
6f57665631
commit
24b9653366
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue