Class: Formulary::FormulaLoader Private

Inherits:
Object
  • Object
show all
Includes:
Context
Defined in:
Library/Homebrew/formulary.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A FormulaLoader returns instances of formulae. Subclasses implement loaders for particular sources of formulae.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Context

current, current=, #debug?, #quiet?, #verbose?, #with_context

Constructor Details

#initialize(name, path) ⇒ FormulaLoader

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FormulaLoader.


126
127
128
129
# File 'Library/Homebrew/formulary.rb', line 126

def initialize(name, path)
  @name = name
  @path = path.resolved_path
end

Instance Attribute Details

#alias_pathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The name used to install the formula


124
125
126
# File 'Library/Homebrew/formulary.rb', line 124

def alias_path
  @alias_path
end

#nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The formula's name


120
121
122
# File 'Library/Homebrew/formulary.rb', line 120

def name
  @name
end

#pathObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The formula's ruby file's path or filename


122
123
124
# File 'Library/Homebrew/formulary.rb', line 122

def path
  @path
end

Instance Method Details

#get_formula(spec, alias_path: nil, force_bottle: false, flags: []) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Gets the formula instance. alias_path can be overridden here in case an alias was used to refer to a formula that was loaded in another way.


134
135
136
137
# File 'Library/Homebrew/formulary.rb', line 134

def get_formula(spec, alias_path: nil, force_bottle: false, flags: [])
  alias_path ||= self.alias_path
  klass(flags: flags).new(name, path, spec, alias_path: alias_path, force_bottle: force_bottle)
end

#klass(flags:) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


139
140
141
142
# File 'Library/Homebrew/formulary.rb', line 139

def klass(flags:)
  load_file(flags: flags) unless Formulary.formula_class_defined?(path)
  Formulary.formula_class_get(path)
end