method

keep_if

Importance_1
Ruby latest stable (v2_5_5) - 0 notes - Class: Array
keep_if() public

Deletes every element of self for which the given block evaluates to false.

See also Array#select!

If no block is given, an Enumerator is returned instead.

a = %w{ a b c d e f }
a.keep_if { |v| v =~ /[aeiou]/ }  #=> ["a", "e"]
Show source
Register or log in to add new notes.