Sha256: 7e35f2739d50df51d98fe344fdcf648f839c5cf95168a560d3316af35e3c0235

Contents?: true

Size: 358 Bytes

Versions: 6

Compression:

Stored size: 358 Bytes

Contents

# frozen_string_literal: true

class Drink
  attr_reader :name, :price

  def initialize(name:, price:)
    @name  = name
    @price = price
  end

  def inflate(inflation)
    @price = (price * (1 + inflation)).round(2)
  end

  def ==(other)
    return false unless other.class == self.class

    other.name == name &&
      other.price == price
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arstotzka-1.6.2 spec/support/models/drink.rb
arstotzka-1.6.1 spec/support/models/drink.rb
arstotzka-1.6.0 spec/support/models/drink.rb
arstotzka-1.5.0 spec/support/models/drink.rb
arstotzka-1.4.4 spec/support/models/drink.rb
arstotzka-1.4.3 spec/support/models/drink.rb