ruby-changes:72703
From: Hiroshi <ko1@a...>
Date: Wed, 27 Jul 2022 14:18:09 +0900 (JST)
Subject: [ruby-changes:72703] 8154b176de (master): Manually sync with https://github.com/ruby/date/pull/64
https://git.ruby-lang.org/ruby.git/commit/?id=8154b176de From 8154b176dee18284772d58c817851bd988e58742 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Wed, 27 Jul 2022 14:17:19 +0900 Subject: Manually sync with https://github.com/ruby/date/pull/64 --- ext/date/date.gemspec | 1 + ext/date/date_core.c | 154 ++++++++++++++++++++++++++++++++++---------------- ext/date/lib/date.rb | 4 ++ 3 files changed, 109 insertions(+), 50 deletions(-) diff --git a/ext/date/date.gemspec b/ext/date/date.gemspec index cf07696976..eecbf786a3 100644 --- a/ext/date/date.gemspec +++ b/ext/date/date.gemspec @@ -12,6 +12,7 @@ Gem::Specification.new do |s| https://github.com/ruby/ruby/blob/trunk/ext/date/date.gemspec#L12 s.require_path = %w{lib} s.files = [ + "README.md", "lib/date.rb", "ext/date/date_core.c", "ext/date/date_parse.c", "ext/date/date_strftime.c", "ext/date/date_strptime.c", "ext/date/date_tmx.h", "ext/date/extconf.rb", "ext/date/prereq.mk", "ext/date/zonetab.h", "ext/date/zonetab.list" diff --git a/ext/date/date_core.c b/ext/date/date_core.c index d7ebcaa784..a1dc9387e0 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -465,6 +465,7 @@ c_find_ldoy(int y, double sg, int *rjd, int *ns) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L465 } #ifndef NDEBUG +/* :nodoc: */ static int c_find_fdom(int y, int m, double sg, int *rjd, int *ns) { @@ -621,6 +622,7 @@ c_jd_to_weeknum(int jd, int f, double sg, int *ry, int *rw, int *rd) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L622 } #ifndef NDEBUG +/* :nodoc: */ static void c_nth_kday_to_jd(int y, int m, int n, int k, double sg, int *rjd, int *ns) { @@ -646,6 +648,7 @@ c_jd_to_wday(int jd) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L648 } #ifndef NDEBUG +/* :nodoc: */ static void c_jd_to_nth_kday(int jd, double sg, int *ry, int *rm, int *rn, int *rk) { @@ -822,6 +825,7 @@ c_valid_weeknum_p(int y, int w, int d, int f, double sg, https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L825 } #ifndef NDEBUG +/* :nodoc: */ static int c_valid_nth_kday_p(int y, int m, int n, int k, double sg, int *rm, int *rn, int *rk, int *rjd, int *ns) @@ -963,6 +967,7 @@ ns_to_day(VALUE n) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L967 } #ifndef NDEBUG +/* :nodoc: */ static VALUE ms_to_sec(VALUE m) { @@ -981,6 +986,7 @@ ns_to_sec(VALUE n) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L986 } #ifndef NDEBUG +/* :nodoc: */ inline static VALUE ins_to_day(int n) { @@ -1016,6 +1022,7 @@ day_to_sec(VALUE d) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L1022 } #ifndef NDEBUG +/* :nodoc: */ static VALUE day_to_ns(VALUE d) { @@ -1040,6 +1047,7 @@ sec_to_ns(VALUE s) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L1047 } #ifndef NDEBUG +/* :nodoc: */ static VALUE isec_to_ns(int s) { @@ -1066,6 +1074,7 @@ div_df(VALUE d, VALUE *f) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L1074 } #ifndef NDEBUG +/* :nodoc: */ static VALUE div_sf(VALUE s, VALUE *f) { @@ -1500,6 +1509,7 @@ m_df(union DateData *x) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L1509 } #ifndef NDEBUG +/* :nodoc: */ static VALUE m_df_in_day(union DateData *x) { @@ -1997,6 +2007,7 @@ expect_numeric(VALUE x) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2007 } #ifndef NDEBUG +/* :nodoc: */ static void civil_to_jd(VALUE y, int m, int d, double sg, VALUE *nth, int *ry, @@ -2309,6 +2320,7 @@ valid_weeknum_p(VALUE y, int w, int d, int f, double sg, https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2320 } #ifndef NDEBUG +/* :nodoc: */ static int valid_nth_kday_p(VALUE y, int m, int n, int k, double sg, VALUE *nth, int *ry, @@ -2446,6 +2458,7 @@ valid_jd_sub(int argc, VALUE *argv, VALUE klass, int need_jd) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2458 } #ifndef NDEBUG +/* :nodoc: */ static VALUE date_s__valid_jd_p(int argc, VALUE *argv, VALUE klass) { @@ -2535,6 +2548,7 @@ valid_civil_sub(int argc, VALUE *argv, VALUE klass, int need_jd) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2548 } #ifndef NDEBUG +/* :nodoc: */ static VALUE date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass) { @@ -2626,6 +2640,7 @@ valid_ordinal_sub(int argc, VALUE *argv, VALUE klass, int need_jd) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2640 } #ifndef NDEBUG +/* :nodoc: */ static VALUE date_s__valid_ordinal_p(int argc, VALUE *argv, VALUE klass) { @@ -2712,6 +2727,7 @@ valid_commercial_sub(int argc, VALUE *argv, VALUE klass, int need_jd) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2727 } #ifndef NDEBUG +/* :nodoc: */ static VALUE date_s__valid_commercial_p(int argc, VALUE *argv, VALUE klass) { @@ -2773,6 +2789,7 @@ date_s_valid_commercial_p(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2789 } #ifndef NDEBUG +/* :nodoc: */ static VALUE valid_weeknum_sub(int argc, VALUE *argv, VALUE klass, int need_jd) { @@ -2804,6 +2821,7 @@ valid_weeknum_sub(int argc, VALUE *argv, VALUE klass, int need_jd) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2821 } } +/* :nodoc: */ static VALUE date_s__valid_weeknum_p(int argc, VALUE *argv, VALUE klass) { @@ -2824,6 +2842,7 @@ date_s__valid_weeknum_p(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2842 return valid_weeknum_sub(5, argv2, klass, 1); } +/* :nodoc: */ static VALUE date_s_valid_weeknum_p(int argc, VALUE *argv, VALUE klass) { @@ -2875,6 +2894,7 @@ valid_nth_kday_sub(int argc, VALUE *argv, VALUE klass, int need_jd) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2894 } } +/* :nodoc: */ static VALUE date_s__valid_nth_kday_p(int argc, VALUE *argv, VALUE klass) { @@ -2895,6 +2915,7 @@ date_s__valid_nth_kday_p(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2915 return valid_nth_kday_sub(5, argv2, klass, 1); } +/* :nodoc: */ static VALUE date_s_valid_nth_kday_p(int argc, VALUE *argv, VALUE klass) { @@ -2917,6 +2938,7 @@ date_s_valid_nth_kday_p(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2938 return Qtrue; } +/* :nodoc: */ static VALUE date_s_zone_to_diff(VALUE klass, VALUE str) { @@ -3112,6 +3134,7 @@ old_to_new(VALUE ajd, VALUE of, VALUE sg, https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3134 } #ifndef NDEBUG +/* :nodoc: */ static VALUE date_s_new_bang(int argc, VALUE *argv, VALUE klass) { @@ -3623,6 +3646,7 @@ date_s_commercial(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3646 } #ifndef NDEBUG +/* :nodoc: */ static VALUE date_s_weeknum(int argc, VALUE *argv, VALUE klass) { @@ -3672,6 +3696,7 @@ date_s_weeknum(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3696 return ret; } +/* :nodoc: */ static VALUE date_s_nth_kday(int argc, VALUE *argv, VALUE klass) { @@ -4471,10 +4496,10 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4496 * Parses the given representation of date and time, and returns a * hash of parsed elements. * - * This method *does not* function as a validator. If the input + * This method *does* *not* function as a validator. If the input * string does not match valid formats strictly, you may get a cryptic - * result. Should consider to use `Date._strptime` or - * `DateTime._strptime` instead of this method as possible. + * result. Should consider to use Date._strptime or DateTime._strptime + * instead of this method as possible. * * If the optional second argument is true and the detected year is in * the range "00" to "99", considers the year a 2-digit form and makes @@ -4483,8 +4508,8 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4508 * Date._parse('2001-02-03') #=> {:year=>2001, :mon=>2, :mday=>3} * * Raise an ArgumentError when the string length is longer than _limit_. - * You can stop this check by passing `limit: nil`, but note that - * it may take a long time to parse. + * You can stop this check by passing <code>limit: nil</code>, but note + * that it may take a long time to parse. */ static VALUE date_s__parse(int argc, VALUE *argv, VALUE klass) @@ -4499,10 +4524,10 @@ date_s__parse(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4524 * Parses the given representation of date and time, and creates a * date object. * - * This method *does not* function as a validator. If the input + * This method *does* *not* function as a validator. If the input * string does not match valid formats strictly, you may get a cryptic - * result. Should consider to use `Date.strptime` instead of this - * method as possible. + * result. Should consider to use Date.strptime instead of this method + * as possible. * * If the optional second argument is true and the detected year is in * the range "00" to "99", considers the year a 2-digit form and makes @@ -4513,8 +4538,8 @@ date_s__parse(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4538 * Date.parse('3rd Feb 2001') #=> #<Date: 2001-02-03 ...> * * Raise an ArgumentError when the string length is longer than _limit_. - * You can stop this check by passing `limit: nil`, but note that - * it may take a long time to parse. + * You can stop this check by passing <code>limit: nil</code>, but note + * that it may take a long time to parse. * * See argument {start}[rd (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/