Class: Date

Inherits:
Object show all
Defined in:
lib/commercebank/monkey.rb

Instance Method Summary collapse

Instance Method Details

#days_in_monthObject



39
40
41
# File 'lib/commercebank/monkey.rb', line 39

def days_in_month
  (Date.parse("12/31/#{strftime("%Y")}") << (12 - month)).day
end

#last_sundayObject



43
44
45
46
47
# File 'lib/commercebank/monkey.rb', line 43

def last_sunday
  d = self
  d -= 1 until d.wday == 0
  d
end