-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo.rb
More file actions
executable file
·42 lines (29 loc) · 862 Bytes
/
demo.rb
File metadata and controls
executable file
·42 lines (29 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env ruby
require_relative "support"
eggs = item("eggs", 0.19)
milk = item("milk", 1.5)
bananas = item("bananas", 0.1)
apples = item("apples", 0.75)
eleanor_cart = ShoppingCart.create(
:data => [
quantified_item(eggs, 12),
quantified_item(bananas, 5),
quantified_item(apples, 4)
]
)
gregory_cart = ShoppingCart.create(
:data => [quantified_item(eggs, 6),
quantified_item(milk, 3),
quantified_item(apples, 4)])
### .................................
#p Item.fields
#Item.update(eggs, :price => 2.5) # Change the price of eggs
#eleanor_cart.first.quantity = 10 # Change the amount of eggs in Eleanors's Cart
### .................................
puts "<ELEANOR>\n\n"
puts eleanor_cart
puts "........................................."
puts "<GREGORY>\n\n"
puts gregory_cart
gets
puts Voom.store