From 79e2379d98ec7fddbbf029e76eac56368a1fab8d Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Thu, 11 Jan 2024 14:37:09 -0800 Subject: [PATCH] Add Array#fourth to resolve cask errors --- Library/Homebrew/extend/array.rb | 5 +++++ Library/Homebrew/extend/array.rbi | 3 +++ 2 files changed, 8 insertions(+) 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