Method: Set#select!
- Defined in:
- lib/set.rb
permalink #select!(&block) ⇒ Object Also known as: filter!
Equivalent to Set#keep_if, but returns nil if no changes were made. Returns an enumerator if no block is given.
586 587 588 589 590 591 |
# File 'lib/set.rb', line 586 def select!(&block) block_given? or return enum_for(__method__) { size } n = size keep_if(&block) self if size != n end |