diff options
| author | Jack Nagel | 2014-04-05 22:03:33 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-04-05 22:03:39 -0500 |
| commit | 34e2c5601dc33607e516557f538a2750d8215e46 (patch) | |
| tree | 08d8b6ae4ce4e17e477f0967de8ed18ee01b7790 /Library | |
| parent | c430752f6d9472629e1688d82cd8214d9c33bbb9 (diff) | |
| download | homebrew-34e2c5601dc33607e516557f538a2750d8215e46.tar.bz2 | |
Pass path directly to StandardLoader when possible
Now we can avoid computing the path twice in the common case.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formulary.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 5e0fd4d3f..5f73ebe6a 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -105,8 +105,8 @@ class Formulary # Loads formulae from Homebrew's provided Library class StandardLoader < FormulaLoader - def initialize name - super name, Formula.path(name) + def initialize name, path=Formula.path(name) + super end end @@ -198,14 +198,15 @@ class Formulary formula_with_that_name = Formula.path(ref) if formula_with_that_name.file? and formula_with_that_name.readable? - return StandardLoader.new(ref) + return StandardLoader.new(ref, formula_with_that_name) end # test if the name is a formula alias possible_alias = Pathname.new("#{HOMEBREW_LIBRARY}/Aliases/#{ref}") if possible_alias.file? - name = possible_alias.resolved_path.basename(".rb").to_s - return StandardLoader.new(name) + path = possible_alias.resolved_path + name = path.basename(".rb").to_s + return StandardLoader.new(name, path) end possible_cached_formula = Pathname.new("#{HOMEBREW_CACHE_FORMULA}/#{ref}.rb") |
