Class: Cask::URL::BlockDSL Private

Inherits:
Object show all
Defined in:
cask/url.rb

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.

Defined Under Namespace

Modules: PageWithURL

Instance Method Summary collapse

Constructor Details

#initialize(uri, dsl: nil, &block) ⇒ 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:



99
100
101
102
103
# File 'cask/url.rb', line 99

def initialize(uri, dsl: nil, &block)
  @uri = uri
  @dsl = dsl
  @block = block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



135
136
137
138
139
140
141
# File 'cask/url.rb', line 135

def method_missing(method, *args, &block)
  if @dsl.respond_to?(method)
    T.unsafe(@dsl).public_send(method, *args, &block)
  else
    super
  end
end

Instance Method Details

#callURI::Generic, ...

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:



106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'cask/url.rb', line 106

def call
  if @uri
    result = ::Utils::Curl.curl_output("--fail", "--silent", "--location", @uri)
    result.assert_success!

    page = result.stdout
    page.extend PageWithURL
    page.url = URI(@uri)

    instance_exec(page, &@block)
  else
    instance_exec(&@block)
  end
end

#respond_to_missing?(method, include_all) ⇒ Boolean

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:

  • (Boolean)


143
144
145
# File 'cask/url.rb', line 143

def respond_to_missing?(method, include_all)
  @dsl.respond_to?(method, include_all) || super
end