Jun 7
2005
Ruby Month 0.1.0
From out of murky depths of the Lafcadio codebase, I bring you a tiny utility library called Ruby Month. It’s a modest thing, intended to make month-level manipulations easier. For example:
require 'month' jun2005 = Month.new( 2005, 6 ) jun2005.to_s # => "Jun 2005" jun2005.start_date.to_s # => "2005-06-01" jun2005.end_date.to_s # => "2005-06-30" jul2005 = jun2005.next jul2005.to_s # => "Jul 2005" may2005 = jun2005.prev may2005.to_s # => "May 2005" to_sort = [ jul2005, may2005, jun2005 ] to_sort.join ', ' # => "Jul 2005, May 2005, Jun 2005" to_sort.sort! to_sort.join ', ' # => "May 2005, Jun 2005, Jul 2005"