mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Fix type for nested url
blocks.
This commit is contained in:
parent
e191b827cc
commit
af1961d509
@ -87,7 +87,8 @@ module Cask
|
|||||||
params(
|
params(
|
||||||
uri: T.nilable(T.any(URI::Generic, String)),
|
uri: T.nilable(T.any(URI::Generic, String)),
|
||||||
dsl: T.nilable(::Cask::DSL),
|
dsl: T.nilable(::Cask::DSL),
|
||||||
block: T.proc.params(arg0: T.all(String, PageWithURL)).returns(T.untyped),
|
block: T.proc.params(arg0: T.all(String, PageWithURL))
|
||||||
|
.returns(T.any(T.any(URI::Generic, String), [T.any(URI::Generic, String), Hash])),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def initialize(uri, dsl: nil, &block)
|
def initialize(uri, dsl: nil, &block)
|
||||||
@ -96,7 +97,7 @@ module Cask
|
|||||||
@block = block
|
@block = block
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { returns(T.untyped) }
|
sig { returns(T.any(T.any(URI::Generic, String), [T.any(URI::Generic, String), Hash])) }
|
||||||
def call
|
def call
|
||||||
if @uri
|
if @uri
|
||||||
result = curl_output("--fail", "--silent", "--location", @uri)
|
result = curl_output("--fail", "--silent", "--location", @uri)
|
||||||
@ -116,8 +117,9 @@ module Cask
|
|||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
uri: T.any(URI::Generic, String),
|
uri: T.any(URI::Generic, String),
|
||||||
block: T.proc.params(arg0: T.all(String, PageWithURL)).returns(T.untyped),
|
block: T.proc.params(arg0: T.all(String, PageWithURL))
|
||||||
).void
|
.returns(T.any(T.any(URI::Generic, String), [T.any(URI::Generic, String), Hash])),
|
||||||
|
).returns(T.any(T.any(URI::Generic, String), [T.any(URI::Generic, String), Hash]))
|
||||||
}
|
}
|
||||||
def url(uri, &block)
|
def url(uri, &block)
|
||||||
self.class.new(uri, &block).call
|
self.class.new(uri, &block).call
|
||||||
@ -156,7 +158,10 @@ module Cask
|
|||||||
only_path: T.nilable(String),
|
only_path: T.nilable(String),
|
||||||
caller_location: Thread::Backtrace::Location,
|
caller_location: Thread::Backtrace::Location,
|
||||||
dsl: T.nilable(::Cask::DSL),
|
dsl: T.nilable(::Cask::DSL),
|
||||||
block: T.nilable(T.proc.params(arg0: T.all(String, BlockDSL::PageWithURL)).returns(T.untyped)),
|
block: T.nilable(
|
||||||
|
T.proc.params(arg0: T.all(String, BlockDSL::PageWithURL))
|
||||||
|
.returns(T.any(T.any(URI::Generic, String), [T.any(URI::Generic, String), Hash])),
|
||||||
|
),
|
||||||
).void
|
).void
|
||||||
}
|
}
|
||||||
def initialize(
|
def initialize(
|
||||||
@ -181,10 +186,9 @@ module Cask
|
|||||||
super(
|
super(
|
||||||
if block
|
if block
|
||||||
LazyObject.new do
|
LazyObject.new do
|
||||||
*args = BlockDSL.new(uri, dsl: dsl, &block).call
|
uri2, options = *BlockDSL.new(uri, dsl: dsl, &block).call
|
||||||
options = args.last.is_a?(Hash) ? args.pop : {}
|
options ||= {}
|
||||||
uri = T.let(args.first, T.any(URI::Generic, String))
|
DSL.new(uri2, **options)
|
||||||
DSL.new(uri, **options)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
DSL.new(
|
DSL.new(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user