Created
January 1, 2015 02:02
-
-
Save meaganewaller/156ddc2af912d8cb6719 to your computer and use it in GitHub Desktop.
secret santa ruby quiz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(0..@santas.size - 1).each do |num| | |
if @santas[num][:assignee][:last_name] == @santas[num][:assignment][:last_name] | |
assign_santas | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def assign_santas | |
@santas = @people.map do |person| | |
{ | |
:assignee => person, | |
:assignment => assignment_for(person) | |
} | |
end | |
if not_everyone_assigned? | |
@assignments = [] | |
assign_santas | |
end | |
@santas | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment