Skip to content

Commit b696c67

Browse files
committed
[Truffle] Adding Array#select! to array.rb
1 parent 3ea7fcd commit b696c67

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

spec/truffle/tags/core/array/select_tags.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

truffle/src/main/ruby/core/rubinius/common/array.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,15 @@ def sample(count=undefined, options=undefined)
926926
return count == size ? result : result[0, count]
927927
end
928928

929+
def select!(&block)
930+
return to_enum :select! unless block_given?
931+
932+
Rubinius.check_frozen
933+
934+
ary = select(&block)
935+
replace ary unless size == ary.size
936+
end
937+
929938
def find_index(obj=undefined)
930939
super
931940
end

0 commit comments

Comments
 (0)