Class: URL

Inherits:
Object show all
Defined in:
url.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, specs = {}) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:



14
15
16
17
18
19
# File 'url.rb', line 14

def initialize(url, specs = {})
  @url = T.let(url.freeze, String)
  @specs = T.let(specs.dup, T::Hash[Symbol, T.untyped])
  @using = T.let(@specs.delete(:using), T.any(NilClass, Symbol, T::Class[AbstractDownloadStrategy]))
  @specs.freeze
end

Instance Attribute Details

#specsHash{Symbol => T.untyped} (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



8
9
10
# File 'url.rb', line 8

def specs
  @specs
end

#usingnil, ... (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



11
12
13
# File 'url.rb', line 11

def using
  @using
end

Instance Method Details

#download_strategyT::Class[AbstractDownloadStrategy]

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



27
28
29
30
# File 'url.rb', line 27

def download_strategy
  @download_strategy ||=
    T.let(DownloadStrategyDetector.detect(@url, @using), T.nilable(T::Class[AbstractDownloadStrategy]))
end

#versionVersion

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:



33
34
35
# File 'url.rb', line 33

def version
  @version ||= T.let(Version.detect(@url, **@specs), T.nilable(Version))
end