Class: Formulary::FormulaContentsLoader Private

Inherits:
FormulaLoader show all
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.

Load formulae directly from their contents.

Instance Attribute Summary collapse

Attributes inherited from FormulaLoader

#alias_path, #name, #path

Instance Method Summary collapse

Methods inherited from FormulaLoader

#get_formula

Methods included from Context

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

Constructor Details

#initialize(name, path, contents) ⇒ FormulaContentsLoader

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 FormulaContentsLoader.


319
320
321
322
# File 'Library/Homebrew/formulary.rb', line 319

def initialize(name, path, contents)
  @contents = contents
  super name, path
end

Instance Attribute Details

#contentsObject (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 contents


317
318
319
# File 'Library/Homebrew/formulary.rb', line 317

def contents
  @contents
end

Instance Method Details

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


324
325
326
327
328
# File 'Library/Homebrew/formulary.rb', line 324

def klass(flags:)
  $stderr.puts "#{$PROGRAM_NAME} (#{self.class.name}): loading #{path}" if debug?
  namespace = "FormulaNamespace#{Digest::MD5.hexdigest(contents.to_s)}"
  Formulary.load_formula(name, path, contents, namespace, flags: flags)
end