Allow Cask refs

This commit is contained in:
Douglas Eichelberger 2024-08-11 18:01:04 -07:00
parent a41f15ede7
commit c799f5f818

View File

@ -52,12 +52,14 @@ module Cask
# Loads a cask from a string.
class FromContentLoader < AbstractContentLoader
sig {
params(ref: T.any(Pathname, String, URI::Generic), warn: T::Boolean)
params(ref: T.any(Pathname, String, Cask, URI::Generic), warn: T::Boolean)
.returns(T.nilable(T.attached_class))
}
def self.try_new(ref, warn: false)
return if ref.is_a?(URI::Generic)
case ref
when Cask, URI::Generic
# do nothing
else
content = ref.to_str
# Cache compiled regex
@ -72,6 +74,7 @@ module Cask
new(content)
end
end
sig { params(content: String, tap: Tap).void }
def initialize(content, tap: T.unsafe(nil))