Module: Enumerable Private
- Included in:
- Dependencies, Homebrew::Style::Offenses, Options, PATH, Requirements, Tap
- Defined in:
- extend/enumerable.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Instance Method Summary collapse
- #compact_blank ⇒ T.self_type private
Returns a new
Arraywithout the blank items. - #exclude?(object) ⇒ Boolean private
The negative of the #include?.
Instance Method Details
#compact_blank ⇒ T.self_type
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns a new Array without the blank items. Uses Object#blank? for determining if an item is blank.
Examples
[1, "", nil, 2, "", [], {}, false, true].compact_blank
# => [1, 2, true]
Set.new([nil, "", 1, false]).compact_blank
# => [1]
When called on a Hash, returns a new Hash without the blank values.
{ a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank
# => { b: 1, f: true }
32 | # File 'extend/enumerable.rb', line 32 def compact_blank = T.unsafe(self).reject(&:blank?) |
#exclude?(object) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
The negative of the #include?. Returns true if the collection does not include the object.
8 | # File 'extend/enumerable.rb', line 8 def exclude?(object) = !include?(object) |
© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Enumerable.html