From babbf008a1fb7db037c1e9293796126298a74a46 Mon Sep 17 00:00:00 2001 From: apainintheneck Date: Tue, 9 Jan 2024 23:33:20 -0800 Subject: [PATCH] formulary: allow for more keyless fields when loading from API These were fields I missed the first time around. Now the values line up with the expected values. --- Library/Homebrew/formulary.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 9e8e313ea3..83ade13a6c 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -165,7 +165,7 @@ module Formulary json_formula = Homebrew::API.merge_variations(json_formula) - uses_from_macos_names = json_formula["uses_from_macos"]&.map do |dep| + uses_from_macos_names = json_formula.fetch("uses_from_macos", []).map do |dep| next dep unless dep.is_a? Hash dep.keys.first @@ -382,12 +382,12 @@ module Formulary self.class.instance_variable_get(:@oldnames_array) end - @aliases_array = json_formula["aliases"] + @aliases_array = json_formula.fetch("aliases", []) def aliases self.class.instance_variable_get(:@aliases_array) end - @versioned_formulae_array = json_formula["versioned_formulae"] + @versioned_formulae_array = json_formula.fetch("versioned_formulae", []) def versioned_formulae_names self.class.instance_variable_get(:@versioned_formulae_array) end