instance method
without
Ruby on Rails 5.2.8.1
Since v5.2.8.1Signature
without(*elements)
Returns a copy of the enumerable without the specified elements.
["David", "Rafael", "Aaron", "Todd"].without "Aaron", "Todd" # => ["David", "Rafael"] {foo: 1, bar: 2, baz: 3}.without :bar # => {foo: 1, baz: 3}
Parameters
-
elementsrest
Source
# File activesupport/lib/active_support/core_ext/enumerable.rb, line 103
def without(*elements)
reject { |element| elements.include?(element) }
end
Defined in activesupport/lib/active_support/core_ext/enumerable.rb line 103
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Enumerable