Class: Date
Overview
Monkey-patch Date Class
Instance Method Summary collapse
-
#wlast(wd) ⇒ Date
Last X: Get last occurence of a given weekday.
-
#wnext(wd) ⇒ Date
Next X: Get next occurence of a given weekday.
Instance Method Details
#wlast(wd) ⇒ Date
Last X: Get last occurence of a given weekday.
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.
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 |