mirror of https://github.com/E-Almqvist/hsf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
319 B
18 lines
319 B
3 years ago
|
class Beverage
|
||
|
attr_accessor :name, :volume, :ingredients
|
||
|
def initialize(name, volume_in_ml, ingredients)
|
||
|
@name = name
|
||
|
@volume = volume_in_ml
|
||
|
@ingredients = ingredients
|
||
|
end
|
||
|
|
||
|
def consume(amount_in_ml)
|
||
|
@volume -= amount_in_ml
|
||
|
if( @volume < 0 ) then @volume = 0 end
|
||
|
end
|
||
|
|
||
|
def empty?
|
||
|
@volume <= 0
|
||
|
end
|
||
|
end
|