Created
February 27, 2009 08:35
-
-
Save perezd/71362 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
require 'smart_month' | |
# an example of the simple to use syntax | |
Time.now.month.first_and_third_friday #=> array of corresponding date objects | |
# access month as an array | |
Month[1] #=> Jan Object | |
Month[12] #=> Dec Object | |
# access month as hash | |
Month[:december] #=> Dec Object | |
Month[:march] #=> Mar Object | |
# access month "dynamically" | |
Month.december #=> Dec Object | |
# access every tuesday in december 2010 | |
Month.december(2010).every_tuesday #=> array of corresponding date objects | |
# access every tuesday and friday in march | |
Month.march.every_tuesday_and_friday #=> array of corresponding date objects | |
Month.march.every!(:tuesday,:friday) #=> hash of corresponding date objects, keyed by the day they are associated with |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment