diff options
| author | Alyssa Ross | 2016-09-07 23:17:19 +0100 |
|---|---|---|
| committer | Alyssa Ross | 2016-09-07 23:17:25 +0100 |
| commit | 8c3a11bca85048c47c0b07528eecbafafd16f8b9 (patch) | |
| tree | 2c7b4a177ffd45df666010f462370dc139508819 | |
| parent | d62029f899afacf86f5bf36669251eb2e3421418 (diff) | |
| download | brew-8c3a11bca85048c47c0b07528eecbafafd16f8b9.tar.bz2 | |
Explain more Tab instantiation methods
| -rw-r--r-- | Library/Homebrew/tab.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 2c3484f42..5adf66194 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -46,10 +46,13 @@ class Tab < OpenStruct new(attributes) end + # Returns the Tab for an install receipt at `path`. + # Results are cached. def self.from_file(path) CACHE.fetch(path) { |p| CACHE[p] = from_file_content(File.read(p), p) } end + # Like Tab.from_file, but bypass the cache. def self.from_file_content(content, path) attributes = Utils::JSON.load(content) attributes["tabfile"] = path @@ -97,6 +100,8 @@ class Tab < OpenStruct end end + # Returns a tab for the named formula's installation, + # or a fake one if the formula is not installed. def self.for_name(name) for_formula(Formulary.factory(name)) end |
