Module: Enumerable Private

Included in:
Homebrew::Style::Offenses, Options, PATH, 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

Instance Method Details

#compact_blankT.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 }

Returns:

  • (T.self_type)


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.

Parameters:

  • object (T.untyped)

Returns:

  • (Boolean)


8
# File 'extend/enumerable.rb', line 8

def exclude?(object) = !include?(object)