Sha256: 748c11ba0b28de74e638de7b19f7cd69ed6c8375ba48ba9da29bb2db73edd1e0

Contents?: true

Size: 267 Bytes

Versions: 10

Compression:

Stored size: 267 Bytes

Contents

class Array

  # As with #select but modifies the Array in place.
  #
  #   a = [1,2,3,4,5,6,7,8,9,10]
  #   a.select!{ |e| e % 2 == 0 }
  #   a  #=> [2,4,6,8,10]
  #
  # CREDIT: Gavin Sinclair
  #
  def select!  # :yield:
    reject!{ |e| not yield(e) }
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facets-2.8.4 lib/core/facets/array/select.rb
facets-2.8.3 lib/core/facets/array/select.rb
facets-2.8.2 lib/core/facets/array/select.rb
facets-2.8.1 lib/core/facets/array/select.rb
facets-2.8.0 lib/core/facets/array/select.rb
facets-2.7.0 lib/core/facets/array/select.rb
facets-2.6.0 lib/core/facets/array/select.rb
facets-2.5.1 lib/core/facets/array/select.rb
facets-2.5.0 lib/core/facets/array/select.rb
facets-2.5.2 lib/core/facets/array/select.rb