diff --git a/Library/Homebrew/extend/array.rb b/Library/Homebrew/extend/array.rb index 7e4b430db9..0163a2bb7f 100644 --- a/Library/Homebrew/extend/array.rb +++ b/Library/Homebrew/extend/array.rb @@ -12,6 +12,11 @@ class Array # %w( a b c d e ).third # => "c" def third = self[2] + # Equal to self[3]. + # + # %w( a b c d e ).fourth # => "d" + def fourth = self[3] + # Converts the array to a comma-separated sentence where the last element is # joined by the connector word. # diff --git a/Library/Homebrew/extend/array.rbi b/Library/Homebrew/extend/array.rbi index 5255357ead..0c1bb89dd7 100644 --- a/Library/Homebrew/extend/array.rbi +++ b/Library/Homebrew/extend/array.rbi @@ -6,4 +6,7 @@ class Array sig { returns(T.nilable(Elem)) } def third; end + + sig { returns(T.nilable(Elem)) } + def fourth; end end