tab: return default values on existing, blank install receipt contents.
This commit is contained in:
parent
128aeba3a4
commit
eaae52edb8
@ -58,7 +58,12 @@ class Tab < OpenStruct
|
|||||||
# Returns the {Tab} for an install receipt at `path`.
|
# Returns the {Tab} for an install receipt at `path`.
|
||||||
# Results are cached.
|
# Results are cached.
|
||||||
def self.from_file(path)
|
def self.from_file(path)
|
||||||
cache.fetch(path) { |p| cache[p] = from_file_content(File.read(p), p) }
|
cache.fetch(path) do |p|
|
||||||
|
content = File.read(p)
|
||||||
|
return empty if content.blank?
|
||||||
|
|
||||||
|
cache[p] = from_file_content(content, p)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Like {from_file}, but bypass the cache.
|
# Like {from_file}, but bypass the cache.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user