Class: Cask::URL Private

Inherits:
SimpleDelegator
  • Object
show all
Includes:
Kernel
Defined in:
cask/url.rb,
sorbet/rbi/dsl/cask/url.rbi

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.

Class corresponding to the url stanza.

Defined Under Namespace

Classes: BlockDSL, DSL

Constant Summary

Constants included from Kernel

Kernel::IGNORE_INTERRUPTS_MUTEX

Instance Method Summary collapse

Methods included from Kernel

#disk_usage_readable, #ensure_executable!, #ensure_formula_installed!, #exec_browser, #exec_editor, #ignore_interrupts, #interactive_shell, #number_readable, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #paths, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #quiet_system, #redact_secrets, #redirect_stdout, #require?, #safe_system, #tap_and_name_comparison, #truncate_text_to_approximate_size, #which, #which_all, #which_editor, #with_custom_locale, #with_env, #with_homebrew_path

Constructor Details

#initialize(uri = nil, verified: nil, using: nil, tag: nil, branch: nil, revisions: nil, revision: nil, trust_cert: nil, cookies: nil, referer: nil, header: nil, user_agent: nil, data: nil, only_path: nil, caller_location: T.must(caller_locations).fetch(0), 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:

  • uri (URI::Generic, String, nil) (defaults to: nil)
  • verified (String, nil) (defaults to: nil)
  • using (Class, Symbol, nil) (defaults to: nil)
  • tag (String, nil) (defaults to: nil)
  • branch (String, nil) (defaults to: nil)
  • revisions (Array<String>, nil) (defaults to: nil)
  • revision (String, nil) (defaults to: nil)
  • trust_cert (Boolean, nil) (defaults to: nil)
  • cookies (Hash{String => String}, nil) (defaults to: nil)
  • referer (URI::Generic, String, nil) (defaults to: nil)
  • header (String, Array<String>, nil) (defaults to: nil)
  • user_agent (Symbol, String, nil) (defaults to: nil)
  • data (Hash{String => String}, nil) (defaults to: nil)
  • only_path (String, nil) (defaults to: nil)
  • caller_location (Thread::Backtrace::Location) (defaults to: T.must(caller_locations).fetch(0))
  • dsl (::Cask::DSL, nil) (defaults to: nil)
  • block (T.proc.params(arg0: T.all(String, BlockDSL::PageWithURL)) .returns(T.any(T.any(URI::Generic, String), [T.any(URI::Generic, String), Hash])), nil)


208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'cask/url.rb', line 208

def initialize(
  uri = nil,
  verified: nil,
  using: nil,
  tag: nil,
  branch: nil,
  revisions: nil,
  revision: nil,
  trust_cert: nil,
  cookies: nil,
  referer: nil,
  header: nil,
  user_agent: nil,
  data: nil,
  only_path: nil,
  caller_location: T.must(caller_locations).fetch(0),
  dsl: nil,
  &block
)
  super(
    if block
      LazyObject.new do
        uri2, options = *BlockDSL.new(uri, dsl: T.must(dsl), &block).call
        options ||= {}
        DSL.new(uri2, **options)
      end
    else
      DSL.new(
        T.must(uri),
        verified:,
        using:,
        tag:,
        branch:,
        revisions:,
        revision:,
        trust_cert:,
        cookies:,
        referer:,
        header:,
        user_agent:,
        data:,
        only_path:,
      )
    end
  )

  @from_block = !block.nil?
  @caller_location = caller_location
end

Instance Method Details

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


12
# File 'sorbet/rbi/dsl/cask/url.rbi', line 12

def branch; end

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


15
# File 'sorbet/rbi/dsl/cask/url.rbi', line 15

def cookies; end

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


18
# File 'sorbet/rbi/dsl/cask/url.rbi', line 18

def data; end

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


275
276
277
# File 'cask/url.rb', line 275

def from_block?
  @from_block
end

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


21
# File 'sorbet/rbi/dsl/cask/url.rbi', line 21

def header; end

#locationHomebrew::SourceLocation

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.



259
260
261
# File 'cask/url.rb', line 259

def location
  Homebrew::SourceLocation.new(@caller_location.lineno, raw_url_line&.index("url"))
end

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


24
# File 'sorbet/rbi/dsl/cask/url.rbi', line 24

def only_path; end

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


27
# File 'sorbet/rbi/dsl/cask/url.rbi', line 27

def path; end

#referer::String, ...

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:



30
# File 'sorbet/rbi/dsl/cask/url.rbi', line 30

def referer; end

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


33
# File 'sorbet/rbi/dsl/cask/url.rbi', line 33

def revision; end

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


36
# File 'sorbet/rbi/dsl/cask/url.rbi', line 36

def revisions; end

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


39
# File 'sorbet/rbi/dsl/cask/url.rbi', line 39

def scheme; end

#specsHash{::Symbol => T.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:



42
# File 'sorbet/rbi/dsl/cask/url.rbi', line 42

def specs; end

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


45
# File 'sorbet/rbi/dsl/cask/url.rbi', line 45

def tag; end

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


51
# File 'sorbet/rbi/dsl/cask/url.rbi', line 51

def trust_cert; end

#unversioned?(ignore_major_version: false) ⇒ 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.

Parameters:

  • ignore_major_version (Boolean) (defaults to: false)

Returns:

  • (Boolean)


264
265
266
267
268
269
270
271
272
# File 'cask/url.rb', line 264

def unversioned?(ignore_major_version: false)
  interpolated_url = raw_url_line&.then { |line| line[/url\s+"([^"]+)"/, 1] }

  return false unless interpolated_url

  interpolated_url = interpolated_url.gsub(/\#{\s*version\s*\.major\s*}/, "") if ignore_major_version

  interpolated_url.exclude?('#{')
end

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


54
# File 'sorbet/rbi/dsl/cask/url.rbi', line 54

def uri; end

#user_agent::String, ...

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:



57
# File 'sorbet/rbi/dsl/cask/url.rbi', line 57

def user_agent; end

#using::Symbol, ...

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:



60
# File 'sorbet/rbi/dsl/cask/url.rbi', line 60

def using; end

#verified::String?

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:



63
# File 'sorbet/rbi/dsl/cask/url.rbi', line 63

def verified; end