Class: Cask::URL::BlockDSL::PageWithURL Private
- Defined in:
- cask/url.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Allow accessing the URL associated with page contents.
Instance Attribute Summary collapse
-
#url ⇒ URI::Generic
Get the URL of the fetched page.
Instance Method Summary collapse
- #initialize(str, url) ⇒ void constructor private
Constructor Details
#initialize(str, url) ⇒ 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.
123 124 125 126 |
# File 'cask/url.rb', line 123 def initialize(str, url) super(str) @url = T.let(url, URI::Generic) end |
Instance Attribute Details
#url ⇒ URI::Generic
Get the URL of the fetched page.
Example
url "https://example.org/download" do |page|
file_path = page[/href="([^"]+\.dmg)"/, 1]
URI.join(page.url, file_path)
end
120 121 122 |
# File 'cask/url.rb', line 120 def url @url end |