Class: Formulary::FromAPILoader Private
- Inherits:
-
FormulaLoader
- Object
- FormulaLoader
- Formulary::FromAPILoader
- Defined in:
- formulary.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.
Load a formula from the API.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from FormulaLoader
#alias_path, #name, #path, #tap
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(name, tap: nil, alias_name: nil) ⇒ void constructor private
- #klass(flags:, ignore_errors:) ⇒ T.class_of(Formula) private
Methods inherited from FormulaLoader
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Methods included from Context
current, current=, #debug?, #quiet?, #verbose?, #with_context
Constructor Details
#initialize(name, tap: nil, alias_name: nil) ⇒ 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.
1054 1055 1056 1057 1058 |
# File 'formulary.rb', line 1054 def initialize(name, tap: nil, alias_name: nil) alias_path = CoreTap.instance.alias_dir/alias_name if alias_name super(name, Formulary.core_path(name), alias_path:, tap:) end |
Class Method Details
.try_new(ref, from: nil, 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.
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 |
# File 'formulary.rb', line 1030 def self.try_new(ref, from: nil, warn: false) return if Homebrew::EnvConfig.no_install_from_api? return unless ref.is_a?(String) return unless (name = ref[HOMEBREW_DEFAULT_TAP_FORMULA_REGEX, :name]) if Homebrew::API.formula_names.exclude?(name) && !Homebrew::API.formula_aliases.key?(name) && !Homebrew::API.formula_renames.key?(name) return end alias_name = name ref = "#{CoreTap.instance}/#{name}" return unless (name_tap_type = Formulary.tap_formula_name_type(ref, warn:)) name, tap, type = name_tap_type alias_name = (type == :alias) ? alias_name.downcase : nil new(name, tap:, alias_name:) end |
Instance Method Details
#klass(flags:, ignore_errors:) ⇒ T.class_of(Formula)
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.
1061 1062 1063 1064 |
# File 'formulary.rb', line 1061 def klass(flags:, ignore_errors:) load_from_api(flags:) unless Formulary.formula_class_defined_from_api?(name) Formulary.formula_class_get_from_api(name) end |