Sha256: c11e2da0884283f25c716e57fa2674616daf19a08130cdd0a0d05b9d76c4f3e6

Contents?: true

Size: 282 Bytes

Versions: 2

Compression:

Stored size: 282 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
punky_brewster-1.3.2 lib/punky_brewster/beer.rb
punky_brewster-1.3.1 lib/punky_brewster/beer.rb