Merge remote-tracking branch 'origin/master' into cask-upgrade/wildcards

This commit is contained in:
JBYoshi 2023-05-11 17:32:36 -05:00
commit d697037aca
No known key found for this signature in database
GPG Key ID: AE4430116622D05D
3 changed files with 346 additions and 271 deletions

View File

@ -109,7 +109,7 @@ module Homebrew
version ||= basename_str[/\A.*(?:--.*?)*--(.*?)#{Regexp.escape(pathname.extname)}\Z/, 1]
version ||= basename_str[/\A.*--?(.*?)#{Regexp.escape(pathname.extname)}\Z/, 1]
return false unless version
return false if version.blank?
version = Version.new(version)

File diff suppressed because it is too large Load Diff

View File

@ -535,7 +535,7 @@ class Version
sig { returns(T::Boolean) }
def null?
@version.nil?
version.nil?
end
sig { params(comparator: String, other: Version).returns(T::Boolean) }
@ -703,7 +703,25 @@ class Version
def to_s
version.to_s
end
alias to_str to_s
sig { returns(String) }
def to_str
raise NoMethodError, "undefined method `to_str' for #{self.class}:NULL" if null?
T.must(version).to_str
end
sig { params(options: Hash).returns(String) }
def to_json(**options)
version.to_json(**options)
end
sig { params(method: T.any(Symbol, String), include_all: T::Boolean).returns(T::Boolean) }
def respond_to?(method, include_all = T.unsafe(nil))
return !null? if ["to_str", :to_str].include?(method)
super
end
sig { returns(String) }
def inspect