Created
March 10, 2017 04:32
-
-
Save itzsaga/da4992da6bcf05420a3b565d15df0c01 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
# given that holiday_hash looks like this: | |
# { | |
# :winter => { | |
# :christmas => ["Lights", "Wreath"], | |
# :new_years => ["Party Hats"] | |
# }, | |
# :summer => { | |
# :fourth_of_july => ["Fireworks", "BBQ"] | |
# }, | |
# :fall => { | |
# :thanksgiving => ["Turkey"] | |
# }, | |
# :spring => { | |
# :memorial_day => ["BBQ"] | |
# } | |
# } | |
def all_supplies_in_holidays(holiday_hash) | |
# iterate through holiday_hash and print items such that your readout resembles: | |
# Winter: | |
# Christmas: Lights, Wreath | |
# New Years: Party Hats | |
# Summer: | |
# Fourth Of July: Fireworks, BBQ | |
# etc. | |
holiday_hash.each do |season, holiday| | |
puts "#{season.to_s.capitalize}:" | |
holiday.each do |holiday_name, supplies| | |
puts " #{holiday_name.to_s.split("_").collect {|split_holiday_name| split_holiday_name.capitalize}.join(" ")}: #{supplies.join(", ")}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment