-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.rb
68 lines (48 loc) · 1.66 KB
/
init.rb
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
require_relative 'app/store_application.rb'
#delayed_job
# StoreApplication.config
# p StoreApplication.respond_to?(:config)
#DSL Domain Specific Language
StoreApplication.config do |app|
app.name = "My Store"
app.environment = :production
app.admin do |admin|
admin.email = "freevova@ukr.net"
admin.login = "admin"
admin.send_info_emails_on :mondays
end
end
# p StoreApplication.environment
# p StoreApplication.name
# p StoreApplication::Admin.email
# p StoreApplication::Admin.login
# unless StoreApplication.frozen?
# StoreApplication.name = "My name"
# StoreApplication::Admin.email = "bad_mail@gmail.com"
# end
@item = []
@item << AntiqueItem.new( 'car', price: 101, weight: 2000)
@item << RealItem.new( 'kettle', price: 100, weight: 50)
@item << RealItem.new( 'dishwasher', price: 101, weight: 100)
cart = Cart.new("vova")
cart.add_item RealItem.new( 'car', price: 100, weight: 100)
cart.add_item RealItem.new( 'car', price: 100, weight: 150)
cart.add_item RealItem.new( 'kettle', price: 100, weight: 50)
# order = Order.new
# @item.each { |i| order.add_item(i) }
# order.place
# p order.placed_at.strftime("%b %-d, %Y %H:%M:%S") #Jan 18, 2016 17:00:00
# p order.time_spend_to_send_email
# method = "all_cars"
# p cart.send(method)
# p cart.items
# puts @item[0].kind_of?(AntiqueItem) # true
# puts @item[0].kind_of?(Item) # true
# puts @item[0].class == AntiqueItem # true
# puts @item[0].class == Item # false
# puts @item[0].respond_to?(:info) # true
# puts @item[0].send(:tax) # value
# p cart.all_kettles
# item1 = RealItem.new(price: 100, name: 'Item', weight: 100)
# puts item1.price
# @item[0].info { |a| puts a }