Use each_with_object
This commit is contained in:
parent
1a40468ce4
commit
e574904cb7
@ -1,16 +1,5 @@
|
||||
# typed: strict
|
||||
|
||||
module Enumerable
|
||||
requires_ancestor { Object }
|
||||
|
||||
sig {
|
||||
type_parameters(:key).params(
|
||||
block: T.nilable(T.proc.params(o: Enumerable::Elem).returns(T.type_parameter(:key))),
|
||||
).returns(T::Hash[T.type_parameter(:key), Enumerable::Elem])
|
||||
}
|
||||
def index_by(&block); end
|
||||
end
|
||||
|
||||
class Hash
|
||||
sig { returns(T::Hash[Hash::K, Hash::V]) }
|
||||
def compact_blank; end
|
||||
|
||||
@ -565,8 +565,8 @@ on_request: installed_on_request?, options: options)
|
||||
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 @@ on_request: installed_on_request?, options: options)
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user