Chapter 7 - Hashes
Exercise 1: Convert months
Below is an
english_date method that takes an ISO date (a standardized format with the year, month, and day, in that order) and converts it to plain English, with the name of the month spelled out. So, “2007-02-24” would be converted to “February 24, 2007”.
But the method is incomplete; the
month_names variable needs to be set to a hash with the month numbers as keys, and the month names as values. Once that’s done, it should be able to convert the months successfully.
When you’re ready, have a look at the solution.