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) ⇒ PageWithURL
constructor
private
A new instance of PageWithURL.
Constructor Details
#initialize(str, url) ⇒ PageWithURL
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 a new instance of PageWithURL.
118 119 120 121 |
# File 'cask/url.rb', line 118 def initialize(str, url) super(str) @url = url 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
116 117 118 |
# File 'cask/url.rb', line 116 def url @url end |