Skip to content

Commit f6bff6e

Browse files
committed
[Truffle] Hash#reject specs.
1 parent ae1593a commit f6bff6e

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

spec/truffle/tags/core/hash/reject_tags.txt

-2
This file was deleted.

truffle/src/main/ruby/core/hash.rb

+14-4
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ def each_item
4444
nil
4545
end
4646

47-
def merge_fallback(other, &block)
48-
merge(Rubinius::Type.coerce_to other, Hash, :to_hash, &block)
49-
end
50-
5147
def find_item(key)
5248
value = _get_or_undefined(key)
5349
if undefined.equal?(value)
@@ -58,4 +54,18 @@ def find_item(key)
5854
end
5955
end
6056

57+
def merge_fallback(other, &block)
58+
merge(Rubinius::Type.coerce_to other, Hash, :to_hash, &block)
59+
end
60+
61+
# Rubinius' Hash#reject taints but we don't want this
62+
63+
def reject(&block)
64+
return to_enum(:reject) unless block_given?
65+
copy = dup
66+
copy.untaint
67+
copy.delete_if(&block)
68+
copy
69+
end
70+
6171
end

0 commit comments

Comments
 (0)