Merge pull request #17643 from samford/livecheck/expand-typed-strict-2

This commit is contained in:
Mike McQuaid 2024-07-08 13:07:52 +01:00 committed by GitHub
commit 341130fa78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew
@ -97,17 +97,13 @@ module Homebrew
# @return [Hash] # @return [Hash]
sig { returns(T::Hash[Symbol, T.untyped]) } sig { returns(T::Hash[Symbol, T.untyped]) }
def strategies def strategies
return @strategies if defined? @strategies @strategies ||= T.let(Strategy.constants.sort.each_with_object({}) do |const_symbol, hash|
@strategies = {}
Strategy.constants.sort.each do |const_symbol|
constant = Strategy.const_get(const_symbol) constant = Strategy.const_get(const_symbol)
next unless constant.is_a?(Class) next unless constant.is_a?(Class)
key = Utils.underscore(const_symbol).to_sym key = Utils.underscore(const_symbol).to_sym
@strategies[key] = constant hash[key] = constant
end end, T.nilable(T::Hash[Symbol, T.untyped]))
@strategies
end end
private_class_method :strategies private_class_method :strategies