class Date
Public Class Methods
days_in_month(year, month)
click to toggle source
# File lib/dohutil/core_ext/date.rb, line 5 def self.days_in_month(year, month) civil(year, month, -1).mday end
Public Instance Methods
empty?()
click to toggle source
# File lib/dohutil/core_ext/empty.rb, line 14 def empty? return false end
inspect()
click to toggle source
# File lib/dohutil/core_ext/inspect.rb, line 6 def inspect "#<Date:#{strftime('%F')}>" end
make_datetime(hour = 0, minute = 0, second = 0, offset = 0)
click to toggle source
# File lib/dohutil/core_ext/date.rb, line 13 def make_datetime(hour = 0, minute = 0, second = 0, offset = 0) DateTime.new(year, month, mday, hour, minute, second, offset) end
make_local_datetime(hour = 0, minute = 0, second = 0)
click to toggle source
# File lib/dohutil/core_ext/date.rb, line 17 def make_local_datetime(hour = 0, minute = 0, second = 0) DateTime.local(year, month, mday, hour, minute, second) end
next_weekday()
click to toggle source
# File lib/dohutil/move_weekday.rb, line 4 def next_weekday retval = self + 1 until retval.weekday? retval += 1 end retval end
previous_weekday()
click to toggle source
# File lib/dohutil/move_weekday.rb, line 12 def previous_weekday retval = self - 1 until retval.weekday? retval -= 1 end retval end
to_display()
click to toggle source
# File lib/dohutil/to_display.rb, line 22 def to_display strftime('%m/%d/%Y') end
weekday?()
click to toggle source
# File lib/dohutil/core_ext/date.rb, line 9 def weekday? (wday > 0) && (wday < 6) end