Class: Date

Inherits:
Object show all
Defined in:
lib/dohutil/to_display.rb,
lib/dohutil/core_ext/date.rb,
lib/dohutil/core_ext/inspect.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.days_in_month(year, month) ⇒ Object



4
5
6
# File 'lib/dohutil/core_ext/date.rb', line 4

def self.days_in_month(year, month)
  civil(year, month, -1).mday
end

Instance Method Details

#inspectObject



6
7
8
# 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) ⇒ Object



12
13
14
# File 'lib/dohutil/core_ext/date.rb', line 12

def make_datetime(hour = 0, minute = 0, second = 0, offset = 0)
  DateTime.new(year, month, mday, hour, minute, second, offset)
end

#to_displayObject



22
23
24
# File 'lib/dohutil/to_display.rb', line 22

def to_display
  strftime('%m/%d/%Y')
end

#weekday?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/dohutil/core_ext/date.rb', line 8

def weekday?
  (wday > 0) && (wday < 6)
end