Method: Array#keep_if

Defined in:
lib/jinx/helpers/array.rb

#keep_if {|item| ... } ⇒ Array

Deletes items from this array which do not satisfy the given block.

Yields:

  • (item)

    the retention test

Yield Parameters:

  • item

    an item in this array

Returns:

  • this array



38
39
40
# File 'lib/jinx/helpers/array.rb', line 38

def keep_if
  delete_if { |item| not yield(item) }
end