Class: Array Private
- 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
Instance Method Summary collapse
-
#blank? ⇒ Boolean
private
An array is blank if it's empty:.
-
#deep_dup ⇒ T.self_type
private
Returns a deep copy of array.
-
#fifth ⇒ Elem?
private
Equal to
self[4]. -
#fourth ⇒ Elem?
private
Equal to
self[3]. - #present? ⇒ Boolean private
-
#second ⇒ Elem?
private
Equal to
self[1]. -
#third ⇒ Elem?
private
Equal to
self[2].
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
12 |
# File 'extend/blank/array.rb', line 12 def blank? = empty? |
#deep_dup ⇒ 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 deep copy of array.
array = [1, [2, 3]]
dup = array.deep_dup
dup[1][2] = 4
array[1][2] # => nil
dup[1][2] # => 4
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 |
#fifth ⇒ Elem?
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"
39 |
# File 'extend/array.rb', line 39 def fifth = self[4] |
#fourth ⇒ Elem?
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"
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.
15 |
# File 'extend/blank/array.rb', line 15 def present? = !empty? # :nodoc: |
#second ⇒ Elem?
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"
12 |
# File 'extend/array.rb', line 12 def second = self[1] |
#third ⇒ Elem?
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"
21 |
# File 'extend/array.rb', line 21 def third = self[2] |