From ccb1c03ce751cc7556235e5c93eb098177789d29 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 22 Jan 2024 10:41:48 -0800 Subject: [PATCH] Use each_with_object --- Library/Homebrew/formula_installer.rb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 292e91fc8cd6e4..4d7a21cf960bd3 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -565,8 +565,8 @@ def runtime_requirements(formula) def expand_requirements unsatisfied_reqs = Hash.new { |h, k| h[k] = [] } formulae = [formula] - formula_deps_map = {} - formula.recursive_dependencies.each { |dep| formula_deps_map[dep.name] = dep } + formula_deps_map = formula.recursive_dependencies + .each_with_object({}) { |dep, h| h[dep.name] = dep } while (f = formulae.pop) runtime_requirements = runtime_requirements(f) @@ -1206,11 +1206,10 @@ def previously_fetched_formula def fetch_bottle_tab @fetch_bottle_tab ||= begin formula.fetch_bottle_tab - @bottle_tab_runtime_dependencies = {} - formula.bottle_tab_attributes - .fetch("runtime_dependencies", []) - .each { |dep| @bottle_tab_runtime_dependencies[dep["full_name"]] = dep } - @bottle_tab_runtime_dependencies.freeze + @bottle_tab_runtime_dependencies = formula.bottle_tab_attributes + .fetch("runtime_dependencies", []) + .each_with_object({}) { |dep, h| h[dep["full_name"]] = dep } + .freeze true rescue DownloadError, ArgumentError @fetch_bottle_tab = true