Class: Cask::URL::BlockDSL::PageWithURL Private

Inherits:
SimpleDelegator
  • Object
show all
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

Instance Method Summary collapse

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

#urlURI::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

Returns:

  • (URI::Generic)


116
117
118
# File 'cask/url.rb', line 116

def url
  @url
end