Top Level Namespace
Defined Under Namespace
Modules: VendingMachine
Classes: Cash, InvalidCoinError, Machine, MoreMoneyError, NoMoneyError, OutOfMoneyError, OutOfSelectedProductError, Product
Instance Method Summary
collapse
Instance Method Details
#change ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/vending_machine.rb', line 19
def change
{
"1c" => 100,
"2c" => 100,
"5c" => 100,
"10c" => 100,
"20c" => 100,
"50c" => 100,
"€1" => 100,
"€2" => 100
}
end
|
#products ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/vending_machine.rb', line 4
def products
snickers = Product.new(name: "Snickers", price: "€2")
mars_bar = Product.new(name: "Mars Bar", price: "€1")
{
"Snickers" => {
product: snickers,
available: 10
},
"Mars Bar" => {
product: mars_bar,
available: 5
}
}
end
|