From bb6bcd18656f56f5f9f04a9cdb471865c75317ca Mon Sep 17 00:00:00 2001 From: tadf Date: Sat, 29 Oct 2005 08:03:46 +0000 Subject: synchronized with date2 3.7 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/date.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/date.rb') diff --git a/lib/date.rb b/lib/date.rb index 9d33198235..93419091ae 100644 --- a/lib/date.rb +++ b/lib/date.rb @@ -839,6 +839,10 @@ class Date once :wday + DAYNAMES.each_with_index do |n, i| + define_method(n.downcase + '?'){wday == i} + end + # Is the current date old-style (Julian Calendar)? def os? () self.class.os?(jd, @sg) end @@ -969,6 +973,9 @@ class Date # of the returned Date will be the last day of the target month. def << (n) self >> -n end + def next_month(n=1) self >> n end + def prev_month(n=1) self << n end + # Step the current date forward +step+ days at a # time (or backward, if +step+ is negative) until # we reach +limit+ (inclusive), yielding the resultant -- cgit v1.2.3