Today was strong work. I finished Procedural Ruby! Now I have Object Oriented Ruby which has final projects and I’m done with the Ruby section! I have to say it started to feel like I wasn’t making progress but the last two days have reinvigorated me. I know it gets more complex as I go and the projects get bigger and take longer but the groove is starting to fall in place.
I spend a good amount of time on the second to last lab of Procedural Ruby (there is a small RegEx section that is last). One specific part was hard but I was stoked with the elegant (so I think) answer I was able to come up with. My original plan was NOT this.
# 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
:-)
I wish I could have done a few more lessons tonight but my next lesson has me watching a 1:10:00 long video. It was still a good productive weekday.
Time spent today: 4:08
Time spent total: 45:15
Lessons completed today: 12
Lessons completed total: 230
Share this post
Twitter
Facebook
LinkedIn
Email