ruby-changes:46030
From: usa <ko1@a...>
Date: Sun, 26 Mar 2017 01:48:11 +0900 (JST)
Subject: [ruby-changes:46030] usa:r58101 (ruby_2_2): merge revision(s) 57549: [Backport #13193]
usa 2017-03-26 01:48:05 +0900 (Sun, 26 Mar 2017) New Revision: 58101 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58101 Log: merge revision(s) 57549: [Backport #13193] date_core.c: [DOC] revise docs [ci skip] * fix malformed rdoc for Date#today, Date._strptime, and DateTime._strptime * add code examples for Date#<< and Date#>> to demonstrate that different dates can result in the same return value * use Date::ITALY in call-seq instead of only ITALY * fix some copy/paste mistakes where Date should be DateTime * fix various errors and grammar * fix cross references and formatting [ruby-core:79433] [Bug #13193] Author: Marcus Stollsteimer <sto.mar@w...> Modified directories: branches/ruby_2_2/ Modified files: branches/ruby_2_2/ext/date/date_core.c branches/ruby_2_2/version.h Index: ruby_2_2/version.h =================================================================== --- ruby_2_2/version.h (revision 58100) +++ ruby_2_2/version.h (revision 58101) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.7" #define RUBY_RELEASE_DATE "2017-03-26" -#define RUBY_PATCHLEVEL 433 +#define RUBY_PATCHLEVEL 434 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_2/ext/date/date_core.c =================================================================== --- ruby_2_2/ext/date/date_core.c (revision 58100) +++ ruby_2_2/ext/date/date_core.c (revision 58101) @@ -2457,7 +2457,7 @@ date_s__valid_jd_p(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L2457 * * Date.valid_jd?(2451944) #=> true * - * See also jd. + * See also ::jd. */ static VALUE date_s_valid_jd_p(int argc, VALUE *argv, VALUE klass) @@ -2546,7 +2546,7 @@ date_s__valid_civil_p(int argc, VALUE *a https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L2546 * Date.valid_date?(2001,2,3) #=> true * Date.valid_date?(2001,2,29) #=> false * - * See also jd and civil. + * See also ::jd and ::civil. */ static VALUE date_s_valid_civil_p(int argc, VALUE *argv, VALUE klass) @@ -2627,7 +2627,7 @@ date_s__valid_ordinal_p(int argc, VALUE https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L2627 * Date.valid_ordinal?(2001,34) #=> true * Date.valid_ordinal?(2001,366) #=> false * - * See also jd and ordinal. + * See also ::jd and ::ordinal. */ static VALUE date_s_valid_ordinal_p(int argc, VALUE *argv, VALUE klass) @@ -2709,7 +2709,7 @@ date_s__valid_commercial_p(int argc, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L2709 * Date.valid_commercial?(2001,5,6) #=> true * Date.valid_commercial?(2001,5,8) #=> false * - * See also jd and commercial. + * See also ::jd and ::commercial. */ static VALUE date_s_valid_commercial_p(int argc, VALUE *argv, VALUE klass) @@ -3257,7 +3257,7 @@ static VALUE d_lite_plus(VALUE, VALUE); https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L3257 * Date.jd(2451945) #=> #<Date: 2001-02-04 ...> * Date.jd(0) #=> #<Date: -4712-01-01 ...> * - * See also new. + * See also ::new. */ static VALUE date_s_jd(int argc, VALUE *argv, VALUE klass) @@ -3307,7 +3307,7 @@ date_s_jd(int argc, VALUE *argv, VALUE k https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L3307 * Date.ordinal(2001,34) #=> #<Date: 2001-02-03 ...> * Date.ordinal(2001,-1) #=> #<Date: 2001-12-31 ...> * - * See also jd and new. + * See also ::jd and ::new. */ static VALUE date_s_ordinal(int argc, VALUE *argv, VALUE klass) @@ -3375,7 +3375,7 @@ date_s_ordinal(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L3375 * Date.new(2001,2,3) #=> #<Date: 2001-02-03 ...> * Date.new(2001,2,-1) #=> #<Date: 2001-02-28 ...> * - * See also jd. + * See also ::jd. */ static VALUE date_s_civil(int argc, VALUE *argv, VALUE klass) @@ -3452,7 +3452,7 @@ date_s_civil(int argc, VALUE *argv, VALU https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L3452 * Date.commercial(2002) #=> #<Date: 2001-12-31 ...> * Date.commercial(2001,5,6) #=> #<Date: 2001-02-03 ...> * - * See also jd and new. + * See also ::jd and ::new. */ static VALUE date_s_commercial(int argc, VALUE *argv, VALUE klass) @@ -3626,9 +3626,9 @@ static void set_sg(union DateData *, dou https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L3626 * call-seq: * Date.today([start=Date::ITALY]) -> date * - * Date.today #=> #<Date: 2011-06-11 ..> - * * Creates a date object denoting the present day. + * + * Date.today #=> #<Date: 2011-06-11 ...> */ static VALUE date_s_today(int argc, VALUE *argv, VALUE klass) @@ -4230,7 +4230,7 @@ date_s__strptime_internal(int argc, VALU https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4230 * Date._strptime('2001-02-03', '%Y-%m-%d') * #=> {:year=>2001, :mon=>2, :mday=>3} * - * See also strptime(3) and strftime. + * See also strptime(3) and #strftime. */ static VALUE date_s__strptime(int argc, VALUE *argv, VALUE klass) @@ -4240,7 +4240,7 @@ date_s__strptime(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4240 /* * call-seq: - * Date.strptime([string='-4712-01-01'[, format='%F'[, start=ITALY]]]) -> date + * Date.strptime([string='-4712-01-01'[, format='%F'[, start=Date::ITALY]]]) -> date * * Parses the given representation of date and time with the given * template, and creates a date object. strptime does not support @@ -4254,7 +4254,7 @@ date_s__strptime(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4254 * Date.strptime('2001 05 6', '%Y %W %u') #=> #<Date: 2001-02-03 ...> * Date.strptime('sat3feb01', '%a%d%b%y') #=> #<Date: 2001-02-03 ...> * - * See also strptime(3) and strftime. + * See also strptime(3) and #strftime. */ static VALUE date_s_strptime(int argc, VALUE *argv, VALUE klass) @@ -4334,7 +4334,7 @@ date_s__parse(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4334 /* * call-seq: - * Date.parse(string='-4712-01-01'[, comp=true[, start=ITALY]]) -> date + * Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]]) -> date * * Parses the given representation of date and time, and creates a * date object. This method does not function as a validator. @@ -4394,7 +4394,7 @@ date_s__iso8601(VALUE klass, VALUE str) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4394 /* * call-seq: - * Date.iso8601(string='-4712-01-01'[, start=ITALY]) -> date + * Date.iso8601(string='-4712-01-01'[, start=Date::ITALY]) -> date * * Creates a new Date object by parsing from a string according to * some typical ISO 8601 formats. @@ -4437,7 +4437,7 @@ date_s__rfc3339(VALUE klass, VALUE str) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4437 /* * call-seq: - * Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=ITALY]) -> date + * Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY]) -> date * * Creates a new Date object by parsing from a string according to * some typical RFC 3339 formats. @@ -4478,7 +4478,7 @@ date_s__xmlschema(VALUE klass, VALUE str https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4478 /* * call-seq: - * Date.xmlschema(string='-4712-01-01'[, start=ITALY]) -> date + * Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY]) -> date * * Creates a new Date object by parsing from a string according to * some typical XML Schema formats. @@ -4520,8 +4520,8 @@ date_s__rfc2822(VALUE klass, VALUE str) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4520 /* * call-seq: - * Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> date - * Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=ITALY]) -> date + * Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date + * Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY]) -> date * * Creates a new Date object by parsing from a string according to * some typical RFC 2822 formats. @@ -4563,7 +4563,7 @@ date_s__httpdate(VALUE klass, VALUE str) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4563 /* * call-seq: - * Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=ITALY]) -> date + * Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY]) -> date * * Creates a new Date object by parsing from a string according to * some RFC 2616 format. @@ -4605,7 +4605,7 @@ date_s__jisx0301(VALUE klass, VALUE str) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L4605 /* * call-seq: - * Date.jisx0301(string='-4712-01-01'[, start=ITALY]) -> date + * Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY]) -> date * * Creates a new Date object by parsing from a string according to * some typical JIS X 0301 formats. @@ -5374,7 +5374,7 @@ dup_obj_with_new_start(VALUE obj, double https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L5374 * call-seq: * d.new_start([start=Date::ITALY]) -> date * - * Duplicates self and resets its the day of calendar reform. + * Duplicates self and resets its day of calendar reform. * * d = Date.new(1582,10,15) * d.new_start(Date::JULIAN) #=> #<Date: 1582-10-05 ...> @@ -5492,9 +5492,9 @@ d_lite_new_offset(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L5492 * call-seq: * d + other -> date * - * Returns a date object pointing other days after self. The other - * should be a numeric value. If the other is flonum, assumes its - * precision is at most nanosecond. + * Returns a date object pointing +other+ days after self. The other + * should be a numeric value. If the other is a fractional number, + * assumes its precision is at most nanosecond. * * Date.new(2001,2,3) + 1 #=> #<Date: 2001-02-04 ...> * DateTime.new(2001,2,3) + Rational(1,2) @@ -5878,8 +5878,8 @@ minus_dd(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L5878 * * Returns the difference between the two dates if the other is a date * object. If the other is a numeric value, returns a date object - * pointing other days before self. If the other is flonum, assumes - * its precision is at most nanosecond. + * pointing +other+ days before self. If the other is a fractional number, + * assumes its precision is at most nanosecond. * * Date.new(2001,2,3) - 1 #=> #<Date: 2001-02-02 ...> * DateTime.new(2001,2,3) - Rational(1,2) @@ -5961,12 +5961,13 @@ d_lite_next(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L5961 * call-seq: * d >> n -> date * - * Returns a date object pointing n months after self. The n should - * be a numeric value. + * Returns a date object pointing +n+ months after self. + * The argument +n+ should be a numeric value. * - * Date.new(2001,2,3) >> 1 #=> #<Date: 2001-03-03 ...> - * Date.new(2001,1,31) >> 1 #=> #<Date: 2001-02-28 ...> - * Date.new(2001,2,3) >> -2 #=> #<Date: 2000-12-03 ...> + * Date.new(2001,2,3) >> 1 #=> #<Date: 2001-03-03 ...> + * Date.new(2001,1,30) >> 1 #=> #<Date: 2001-02-28 ...> + * Date.new(2001,1,31) >> 1 #=> #<Date: 2001-02-28 ...> + * Date.new(2001,2,3) >> -2 #=> #<Date: 2000-12-03 ...> */ static VALUE d_lite_rshift(VALUE self, VALUE other) @@ -6011,12 +6012,13 @@ d_lite_rshift(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6012 * call-seq: * d << n -> date * - * Returns a date object pointing n months before self. The n should - * be a numeric value. + * Returns a date object pointing +n+ months before self. + * The argument +n+ should be a numeric value. * - * Date.new(2001,2,3) << 1 #=> #<Date: 2001-01-03 ...> - * Date.new(2001,1,31) << 11 #=> #<Date: 2000-02-29 ...> - * Date.new(2001,2,3) << -1 #=> #<Date: 2001-03-03 ...> + * Date.new(2001,2,3) << 1 #=> #<Date: 2001-01-03 ...> + * Date.new(2001,1,30) << 11 #=> #<Date: 2000-02-29 ...> + * Date.new(2001,1,31) << 11 #=> #<Date: 2000-02-29 ...> + * Date.new(2001,2,3) << -1 #=> #<Date: 2001-03-03 ...> */ static VALUE d_lite_lshift(VALUE self, VALUE other) @@ -6028,7 +6030,7 @@ d_lite_lshift(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6030 * call-seq: * d.next_month([n=1]) -> date * - * This method is equivalent to d >> n + * This method is equivalent to d >> n. */ static VALUE d_lite_next_month(int argc, VALUE *argv, VALUE self) @@ -6045,7 +6047,7 @@ d_lite_next_month(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6047 * call-seq: * d.prev_month([n=1]) -> date * - * This method is equivalent to d << n + * This method is equivalent to d << n. */ static VALUE d_lite_prev_month(int argc, VALUE *argv, VALUE self) @@ -6062,7 +6064,7 @@ d_lite_prev_month(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6064 * call-seq: * d.next_year([n=1]) -> date * - * This method is equivalent to d >> (n * 12) + * This method is equivalent to d >> (n * 12). */ static VALUE d_lite_next_year(int argc, VALUE *argv, VALUE self) @@ -6079,7 +6081,7 @@ d_lite_next_year(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6081 * call-seq: * d.prev_year([n=1]) -> date * - * This method is equivalent to d << (n * 12) + * This method is equivalent to d << (n * 12). */ static VALUE d_lite_prev_year(int argc, VALUE *argv, VALUE self) @@ -6267,11 +6269,11 @@ cmp_dd(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6269 * should be a date object or a numeric value as an astronomical * Julian day number. * - * Date.new(2001,2,3) <=> Date.new(2001,2,4) #=> -1 - * Date.new(2001,2,3) <=> Date.new(2001,2,3) #=> 0 - * Date.new(2001,2,3) <=> Date.new(2001,2,2) #=> 1 - * Date.new(2001,2,3) <=> Object.new #=> nil - * Date.new(2001,2,3) <=> Rational(4903887,2)#=> 0 + * Date.new(2001,2,3) <=> Date.new(2001,2,4) #=> -1 + * Date.new(2001,2,3) <=> Date.new(2001,2,3) #=> 0 + * Date.new(2001,2,3) <=> Date.new(2001,2,2) #=> 1 + * Date.new(2001,2,3) <=> Object.new #=> nil + * Date.new(2001,2,3) <=> Rational(4903887,2) #=> 0 * * See also Comparable. */ @@ -6411,8 +6413,8 @@ static VALUE strftimev(const char *, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6413 * call-seq: * d.to_s -> string * - * Returns a string in an ISO 8601 format (This method doesn't use the - * expanded representations). + * Returns a string in an ISO 8601 format. (This method doesn't use the + * expanded representations.) * * Date.new(2001,2,3).to_s #=> "2001-02-03" */ @@ -6708,32 +6710,32 @@ date_strftime_internal(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6710 * call-seq: * d.strftime([format='%F']) -> string * - * Formats date according to the directives in the given format - * string. - * The directives begins with a percent (%) character. - * Any text not listed as a directive will be passed through to the - * output string. - * - * The directive consists of a percent (%) character, - * zero or more flags, optional minimum field width, - * optional modifier and a conversion specifier - * as follows. + * Formats date according to the directives in the given format + * string. + * The directives begin with a percent (%) character. + * Any text not listed as a directive will be passed through to the + * output string. + * + * The directive consists of a percent (%) character, + * zero or more flags, optional minimum field width, + * optional modifier and a conversion specifier + * as follows. * * %<flags><width><modifier><conversion> * - * Flags: + * Flags: * - don't pad a numerical output. * _ use spaces for padding. * 0 use zeros for padding. * ^ upcase the result string. * # change case. * - * The minimum field width specifies the minimum width. + * The minimum field width specifies the minimum width. * - * The modifiers are "E", "O", ":", "::" and ":::". - * "E" and "O" are ignored. No effect to result currently. + * The modifiers are "E", "O", ":", "::" and ":::". + * "E" and "O" are ignored. No effect to result currently. * - * Format directives: + * Format directives: * * Date (Year, Month, Day): * %Y - Year with century (can be negative, 4 digits at least) @@ -6826,23 +6828,24 @@ date_strftime_internal(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6828 * %T - 24-hour time (%H:%M:%S) * %+ - date(1) (%a %b %e %H:%M:%S %Z %Y) * - * This method is similar to strftime() function defined in ISO C and POSIX. - * Several directives (%a, %A, %b, %B, %c, %p, %r, %x, %X, %E*, %O* and %Z) - * are locale dependent in the function. - * However this method is locale independent. - * So, the result may differ even if a same format string is used in other - * systems such as C. - * It is good practice to avoid %x and %X because there are corresponding - * locale independent representations, %D and %T. + * This method is similar to the strftime() function defined in ISO C + * and POSIX. + * Several directives (%a, %A, %b, %B, %c, %p, %r, %x, %X, %E*, %O* and %Z) + * are locale dependent in the function. + * However, this method is locale independent. + * So, the result may differ even if the same format string is used in other + * systems such as C. + * It is good practice to avoid %x and %X because there are corresponding + * locale independent representations, %D and %T. * - * Examples: + * Examples: * * d = DateTime.new(2007,11,19,8,37,48,"-06:00") * #=> #<DateTime: 2007-11-19T08:37:48-0600 ...> * d.strftime("Printed on %m/%d/%Y") #=> "Printed on 11/19/2007" * d.strftime("at %I:%M%p") #=> "at 08:37AM" * - * Various ISO 8601 formats: + * Various ISO 8601 formats: * %Y%m%d => 20071119 Calendar date (basic) * %F => 2007-11-19 Calendar date (extended) * %Y-%m => 2007-11 Calendar date, reduced accuracy, specific month @@ -6878,7 +6881,7 @@ date_strftime_internal(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L6881 * %GW%V%uT%H%M%z => 2007W471T0837-0600 Week date and local time and difference from UTC (basic) * %G-W%V-%uT%R%:z => 2007-W47-1T08:37-06:00 Week date and local time and difference from UTC (extended) * - * See also strftime(3) and strptime. + * See also strftime(3) and ::strptime. */ static VALUE d_lite_strftime(int argc, VALUE *argv, VALUE self) @@ -7167,7 +7170,7 @@ date_s__load(VALUE klass, VALUE s) https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L7170 * call-seq: * DateTime.jd([jd=0[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]) -> datetime * - * Creates a datetime object denoting the given chronological Julian + * Creates a DateTime object denoting the given chronological Julian * day number. * * DateTime.jd(2451944) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...> @@ -7235,7 +7238,7 @@ datetime_s_jd(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L7238 * call-seq: * DateTime.ordinal([year=-4712[, yday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]) -> datetime * - * Creates a date-time object denoting the given ordinal date. + * Creates a DateTime object denoting the given ordinal date. * * DateTime.ordinal(2001,34) #=> #<DateTime: 2001-02-03T00:00:00+00:00 ...> * DateTime.ordinal(2001,34,4,5,6,'+7') @@ -7311,7 +7314,7 @@ datetime_s_ordinal(int argc, VALUE *argv https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ext/date/date_core.c#L7314 * DateTime.civil([year=-4712[, month=1[, mday=1[, hour=0[, minute=0[, second=0[, offset=0[, start=Date::ITALY]]]]]]]]) -> datetime * DateTime.new([year=-4712[, mon (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/