mirror of https://github.com/E-Almqvist/hsf
parent
47ee07d1e0
commit
8cbfcd2db4
@ -0,0 +1,17 @@ |
|||||||
|
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 |
Loading…
Reference in new issue