Tab#to_s returns a one-line summary of the receipt

This commit is contained in:
Jack Nagel 2013-03-27 23:07:25 -05:00
parent d9f64a1574
commit 5e5e82f9ef

View File

@ -104,4 +104,18 @@ class Tab < OpenStruct
def write
tabfile.write to_json
end
def to_s
s = []
case poured_from_bottle
when true then s << "Poured from bottle"
when false then s << "Built from source"
end
unless used_options.empty?
s << "Installed" if s.empty?
s << "with:"
s << used_options.to_a.join(", ")
end
s.join(" ")
end
end