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) ⇒ 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:

  • str (String)
  • url (URI::Generic)


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

#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)


120
121
122
# File 'cask/url.rb', line 120

def url
  @url
end