Class: Array Private

Inherits:
Object show all
Defined in:
extend/array.rb,
extend/blank/array.rb,
extend/object/deep_dup/array.rb,
extend/array.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Direct Known Subclasses

Homebrew::CLI::NamedArgs

Instance Method Summary collapse

Instance Method Details

#blank?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.

An array is blank if it's empty:

[].blank?      # => true
[1,2,3].blank? # => false

Returns:

  • (Boolean)


12
# File 'extend/blank/array.rb', line 12

def blank? = empty?

#deep_dupT.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 deep copy of array.

array = [1, [2, 3]]
dup   = array.deep_dup
dup[1][2] = 4

array[1][2] # => nil
dup[1][2]   # => 4

Returns:

  • (T.self_type)


14
15
16
17
18
19
20
21
# File 'extend/object/deep_dup/array.rb', line 14

def deep_dup
  dup.map! do |element|
    case element
    when Object then element.deep_dup
    else element
    end
  end
end

#fifthElem?

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.

Equal to self[4].

Example

%w( a b c d e ).fifth # => "e"

Returns:

  • (Elem, nil)


39
# File 'extend/array.rb', line 39

def fifth = self[4]

#fourthElem?

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.

Equal to self[3].

Example

%w( a b c d e ).fourth # => "d"

Returns:

  • (Elem, nil)


30
# File 'extend/array.rb', line 30

def fourth = self[3]

#present?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.

Returns:

  • (Boolean)


15
# File 'extend/blank/array.rb', line 15

def present? = !empty? # :nodoc:

#secondElem?

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.

Equal to self[1].

Example

%w( a b c d e ).second # => "b"

Returns:

  • (Elem, nil)


12
# File 'extend/array.rb', line 12

def second = self[1]

#thirdElem?

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.

Equal to self[2].

Example

%w( a b c d e ).third # => "c"

Returns:

  • (Elem, nil)


21
# File 'extend/array.rb', line 21

def third = self[2]