Skip to content

Commit

Permalink
Use each_with_object
Browse files Browse the repository at this point in the history
  • Loading branch information
dduugg committed Jan 22, 2024
1 parent 4d0db84 commit ccb1c03
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ccb1c03

Please sign in to comment.