Class: Date

Inherits:
Object show all
Defined in:
lib/aromat/date.rb

Overview

Monkey-patch Date Class

Instance Method Summary collapse

Instance Method Details

#wlast(wd) ⇒ Date

Last X: Get last occurence of a given weekday.

Returns:



10
11
12
13
14
# File 'lib/aromat/date.rb', line 10

def wlast wd
	d = self - 1
	d = d - 1 until d.send "#{wd}?".to_sym
	d
end

#wnext(wd) ⇒ Date

Next X: Get next occurence of a given weekday.

Returns:



19
20
21
22
23
# File 'lib/aromat/date.rb', line 19

def wnext wd
	d = self + 1
	d = d + 1 until d.send "#{wd}?".to_sym
	d
end