-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworld.rb
More file actions
34 lines (33 loc) · 716 Bytes
/
world.rb
File metadata and controls
34 lines (33 loc) · 716 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
class Person
attr_reader :name, :hair_color
def initialize(name, hair_color )
@name = name
@hair_color = hair_color
end
def sing
puts "Sometimes it's soft as a misty rain that gently touches my soul it cools the fire that burns in me and I simply lose control!"
end
end
class Wyncoder < Person
def code
p "I am coding!"
end
def to_s
case @name
when "Walter"
"Walter, is the best coder at wyncode!"
end
end
def inspect
case @name
when "Walter"
"Walter, is the best coder at wyncode!"
end
end
end
p walter = Wyncoder.new("Walter", "Blonde")
sandy = Person.new("Sandy","Auburn")
puts walter.name
puts walter.hair_color
walter.code
walter.sing