Last active
August 29, 2015 14:01
-
-
Save appsol/95e258d7b1b70d71b15d to your computer and use it in GitHub Desktop.
Saasbook Project 3.5
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
#!/usr/bin/env ruby | |
# Project 3.5 | |
class Time | |
def at_beginning_of_year | |
self.class.local self.year | |
end | |
end | |
class Fixnum | |
def day | |
self * 60 * 60 * 24 | |
end | |
end | |
# Example | |
Time.now.at_beginning_of_year + 1.day | |
# => 2011-01-02 00:00:00 -0800 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment