Method: Array#without

Defined in:
lib/active_support/core_ext/array/access.rb

#without(*elements) ⇒ Object

Returns a copy of the Array without the specified elements.

people = ["David", "Rafael", "Aaron", "Todd"]
people.without "Aaron", "Todd"
  => ["David", "Rafael"]

Note: This is an optimization of ‘Enumerable#without` that uses `Array#-` instead of `Array#reject` for performance reasons.



38
39
40
# File 'lib/active_support/core_ext/array/access.rb', line 38

def without(*elements)
  self - elements
end