lib/punky_brewster/beer.rb in punky_brewster-1.3.0 vs lib/punky_brewster/beer.rb in punky_brewster-1.3.1
- old
+ new
@@ -1,7 +1,12 @@
module PunkyBrewster
class Beer < Struct.new(:name, :price, :abv, :image_url)
def abv_per_dollar
(abv.to_f / price).round(2)
end
+
+ # Returns true if all expected values have been set.
+ def valid?
+ values.compact.length == members.length
+ end
end
end