Skip to content

Commit

Permalink
livecheck: finish expanding typed: strict
Browse files Browse the repository at this point in the history
I previously expanded use of `typed: strict` in livecheck files but
the exception was `livecheck/strategy.rb`. This addresses the
`@strategies` type errors in that file and upgrades it to
`typed: strict`.

Co-authored-by: apainintheneck <[email protected]>
  • Loading branch information
samford and apainintheneck committed Jul 8, 2024
1 parent 2e2dc59 commit 17d1561
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions Library/Homebrew/livecheck/strategy.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# typed: true
# typed: strict
# frozen_string_literal: true

module Homebrew
Expand Down Expand Up @@ -97,17 +97,13 @@ module Strategy
# @return [Hash]
sig { returns(T::Hash[Symbol, T.untyped]) }
def strategies
return @strategies if defined? @strategies

@strategies = {}
Strategy.constants.sort.each do |const_symbol|
@strategies ||= T.let(Strategy.constants.sort.each_with_object({}) do |const_symbol, hash|
constant = Strategy.const_get(const_symbol)
next unless constant.is_a?(Class)

key = Utils.underscore(const_symbol).to_sym
@strategies[key] = constant
end
@strategies
hash[key] = constant
end, T.nilable(T::Hash[Symbol, T.untyped]))
end
private_class_method :strategies

Expand Down

0 comments on commit 17d1561

Please sign in to comment.