Class: URL::BlockDSL Private

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
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:



96
97
98
99
100
# File 'cask/url.rb', line 96

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



131
132
133
134
135
136
137
# File 'cask/url.rb', line 131

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

#callT.untyped

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:

  • (T.untyped)


103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'cask/url.rb', line 103

def call
  if @uri
    result = 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)


139
140
141
# File 'cask/url.rb', line 139

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