Created
August 17, 2011 00:37
-
-
Save davidguttman/1150534 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
class Time | |
def to_half_hour_start | |
if self.min >= 30 | |
self.to_hour_end - 30.minutes | |
else | |
self.to_hour_start | |
end | |
end | |
def to_half_hour_end | |
if self.min >= 30 | |
self.to_hour_end | |
else | |
self.to_hour_end - 30.minutes | |
end | |
end | |
def to_hour_start | |
self.round - self.min.minutes - self.round.sec.seconds | |
end | |
def to_hour_end | |
self.to_hour_start + 1.hour | |
end | |
def to_day_begin | |
self.round - self.hour.hours - self.min.minutes - self.round.sec.seconds | |
end | |
def to_day_end | |
self.to_day_begin + 1.day | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment