Method: Array#without
- Defined in:
- activesupport/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.
40 41 42 |
# File 'activesupport/lib/active_support/core_ext/array/access.rb', line 40 def without(*elements) self - elements end |