ruby - grade-school
This commit is contained in:
parent
da10e318e4
commit
ddf33000c8
@ -1,3 +1,4 @@
|
|||||||
|
# School class
|
||||||
class School
|
class School
|
||||||
def initialize
|
def initialize
|
||||||
@roster = {}
|
@roster = {}
|
||||||
@ -8,9 +9,7 @@ class School
|
|||||||
end
|
end
|
||||||
|
|
||||||
def add(name, grade)
|
def add(name, grade)
|
||||||
if @roster[grade].nil?
|
@roster[grade] ||= []
|
||||||
@roster[grade] = []
|
|
||||||
end
|
|
||||||
@roster[grade].push(name).sort!
|
@roster[grade].push(name).sort!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user