-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdirectory5_sample.rb
72 lines (54 loc) · 1009 Bytes
/
directory5_sample.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
69
70
71
72
def add(student)
students << student
end
def students
@students ||= []
end
def student_to_s(student)
"#{student[:name]}, #{student[:cohort]} cohort"
end
def students_to_s
students.map.with_index(1) do |student, index|
"#{index}. #{student_to_s(student)}"
end.join("\n")
end
def print_students
show students_to_s
end
# def is_a_hash?
# true
# end
# def user_input
# gets.chomp
# end
def show(string)
puts string
end
def print_header
show "Welcome to the Makers Academy\nThe students of my cohort are..."
end
def print_footer(names)
show "Overall , we have #{names.length} superdooper students"
end
def print_array
show "test"
end
def request_name
show "Please enter the student's name"
request("name")
end
def request_cohort
show "Please enter the student's cohort"
request("cohort")
end
def request_hobby
show "Please enter the student's hobby"
request("hobby")
end
def request(thing)
thing = gets.chomp
end
# request(hobby)
# request(cohort)
# request()
# request_hobby