diff options
| author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-10-29 08:03:46 +0000 |
|---|---|---|
| committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-10-29 08:03:46 +0000 |
| commit | 4c366bbbff252d8dcde1f7693f1942d8d0b77081 (patch) | |
| tree | e6cded697867e48f027f4e6ac97973fb5af60576 | |
| parent | 92ed342b46f79dd10f92f276a001ee012291d193 (diff) | |
| download | ruby-4c366bbbff252d8dcde1f7693f1942d8d0b77081.tar.gz ruby-4c366bbbff252d8dcde1f7693f1942d8d0b77081.tar.xz ruby-4c366bbbff252d8dcde1f7693f1942d8d0b77081.zip | |
synchronized with date2 3.7
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@9479 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 7 | ||||
| -rw-r--r-- | lib/date.rb | 7 |
2 files changed, 14 insertions, 0 deletions
@@ -1,3 +1,10 @@ +Sat Oct 29 16:56:03 2005 Tadayoshi Funaba <tadf@dotrb.org> + + * lib/date.rb: added seven predicates sunday? to saturday?. + + * lib/date.rb: added two methods {prev,next}_month, + that are almost same as << and >>. + Thu Oct 27 20:34:43 2005 Nobuyoshi Nakada <nobu@ruby-lang.org> * enumerator.c (enumerator_allocate): allow subclassing. diff --git a/lib/date.rb b/lib/date.rb index 9d3319823..93419091a 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 |
