-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoop.rb
63 lines (47 loc) · 805 Bytes
/
oop.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
class CoffeMachine
def make_coffee
get_start
get_water(200)
get_beans(50)
coffe_ready
end
def get_start
puts "Start"
end
def coffe_ready
puts "Coffee ready!"
end
def get_water(mls)
puts "Water #{mls}mls."
end
def get_beans(grams)
puts "Beans #{grams}grams."
end
end
one = CoffeMachine.new
one.make_coffee
p "Line".center(50, "=")
two = CoffeMachine.new
two.make_coffee
class Father
def check_self(object)
object == self
end
end
son = Father.new
p son
p son.check_self(son)
p son.check_self(Father)
class People
puts "Class self: #{self}"
def print_self
puts "Method self: #{self}"
end
end
p "Line".center(50, "=")
people = People.new
p people
p people.print_self
p people.methods
#p "Line".center(50, "=")
#p People.instance_methods