Class: Formulary::FromCacheLoader Private

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

Loads a formula from a cached formula file.

Instance Attribute Summary

Attributes inherited from FormulaLoader

#alias_path, #name, #path, #tap

Class Method Summary collapse

Methods inherited from FormulaLoader

#get_formula, #initialize, #klass

Methods included from Context

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

Constructor Details

This class inherits a constructor from Formulary::FormulaLoader

Class Method Details

.try_new(ref, from: T.unsafe(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.

Parameters:

  • ref (String, Pathname, URI::Generic)
  • from (Symbol) (defaults to: T.unsafe(nil))
  • warn (Boolean) (defaults to: false)

Returns:

  • (T.attached_class, nil)


863
864
865
866
867
868
869
# File 'formulary.rb', line 863

def self.try_new(ref, from: T.unsafe(nil), warn: false)
  ref = ref.to_s

  return unless (cached_formula = HOMEBREW_CACHE_FORMULA/"#{ref}.rb").file?

  new(ref, cached_formula)
end