Created
January 20, 2016 22:38
-
-
Save QuillyT/f4695dbd709e6f24f30c to your computer and use it in GitHub Desktop.
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 create_enrollments_hash(district, year, percentage) | |
build_or_check_hash(enrollments, district, year) | |
unless percentage == nil | |
enrollments[district][type][year] = percentage | |
end | |
end | |
def build_or_check_hash(a_hash, *some_keys) | |
temp_hash = a_hash | |
some_keys.each do |key| | |
temp_hash[key] = {} if temp_hash.nil? | |
temp_hash = temp_hash[key] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment