Spec-Zone.ru › Homebrew

Class: Cask::CaskLoader::FromInstalledPathLoader Private

Inherits:
FromPathLoader
  • Object
  • AbstractContentLoader
  • FromPathLoader
  • Cask::CaskLoader::FromInstalledPathLoader
show all
Defined in:
cask/cask_loader.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.

Loader which loads a cask from the installed cask file.

Instance Attribute Summary

Attributes inherited from FromPathLoader

#path, #token

Attributes inherited from AbstractContentLoader

#content, #tap

Class Method Summary collapse

  • .try_new(ref, warn: false) ⇒ T.attached_class? private

Instance Method Summary collapse

  • #initialize(path, token: "") ⇒ void constructor private

Methods inherited from FromPathLoader

invalid_path?, #load

Methods included from ILoader

#load

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_upgradable, #pretty_warning

Constructor Details

#initialize(path, token: "") ⇒ 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:

  • path (Pathname, String)
  • token (String) (defaults to: "")


620
621
622
623
624
625
626
# File 'cask/cask_loader.rb', line 620

def initialize(path, token: "")
  super

  installed_tap = Cask.new(@token).tab.tap
  @tap = installed_tap if installed_tap
  @from_installed_caskfile = T.let(true, T::Boolean)
end

Class Method Details

.try_new(ref, warn: false) ⇒ T.attached_class?

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:

  • ref (String, Pathname, Cask, URI::Generic)
  • warn (Boolean) (defaults to: false)

Returns:

  • (T.attached_class, nil)


605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'cask/cask_loader.rb', line 605

def self.try_new(ref, warn: false)
  token = if ref.is_a?(String)
    ref
  elsif ref.is_a?(Pathname)
    ref.basename(ref.extname).basename(".internal").to_s
  end
  return unless token

  possible_installed_cask = Cask.new(token)
  return unless (installed_caskfile = possible_installed_cask.installed_caskfile)

  new(installed_caskfile)
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Cask/CaskLoader/FromInstalledPathLoader.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API