ruby-changes:72461
From: Burdette <ko1@a...>
Date: Fri, 8 Jul 2022 03:48:22 +0900 (JST)
Subject: [ruby-changes:72461] 621e5c568a (master): [ruby/date] Enhanced RDoc (https://github.com/ruby/date/pull/58)
https://git.ruby-lang.org/ruby.git/commit/?id=621e5c568a From 621e5c568af8881c58eb3c271e01fba5fe76a6a3 Mon Sep 17 00:00:00 2001 From: Burdette Lamar <BurdetteLamar@Y...> Date: Thu, 7 Jul 2022 13:47:55 -0500 Subject: [ruby/date] Enhanced RDoc (https://github.com/ruby/date/pull/58) Brings a dozen call-seq schemas into compliance with the doc guide. Adds links to section "Argument start" where needed. Revises (minorly) ::today. Otherwise, does not disturb existing text. https://github.com/ruby/date/commit/9aec11df50 --- ext/date/date_core.c | 86 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 30 deletions(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index dc0f00169a..e71eec217c 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -2473,6 +2473,8 @@ date_s__valid_jd_p(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2473 * * Date.valid_jd?(2451944) # => true * + * See argument {start}[rdoc-ref:Date@Argument+start]. + * * Related: Date.jd. */ static VALUE @@ -2564,7 +2566,7 @@ date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2566 * Date.valid_date?(2001, 2, 29) # => false * Date.valid_date?(2001, 2, -1) # => true * - * See {Argument start}[rdoc-ref:Date@Argument+start]. + * See argument {start}[rdoc-ref:Date@Argument+start]. * * Date.valid_date? is an alias for Date.valid_civil?. * @@ -2653,7 +2655,7 @@ date_s__valid_ordinal_p(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2655 * Date.valid_ordinal?(2001, 34) # => true * Date.valid_ordinal?(2001, 366) # => false * - * See {Argument start}[rdoc-ref:Date@Argument+start]. + * See argument {start}[rdoc-ref:Date@Argument+start]. * * Related: Date.jd, Date.ordinal. */ @@ -2742,7 +2744,7 @@ date_s__valid_commercial_p(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L2744 * * See Date.commercial. * - * See {Argument start}[rdoc-ref:Date@Argument+start]. + * See argument {start}[rdoc-ref:Date@Argument+start]. * * Related: Date.jd, Date.commercial. */ @@ -3317,7 +3319,7 @@ static VALUE d_lite_plus(VALUE, VALUE); https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3319 * * Date.jd(Date::ITALY - 1).julian? # => true * - * See {Argument start}[rdoc-ref:Date@Argument+start]. + * See argument {start}[rdoc-ref:Date@Argument+start]. * * Related: Date.new. */ @@ -3358,7 +3360,7 @@ date_s_jd(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3360 /* * call-seq: - * Date.ordinal(year = -4712, yday = 1, start = Date::ITALY) -> date + * Date.ordinal(year = -4712, yday = 1, start = Date::ITALY) -> date * * Returns a new \Date object formed fom the arguments. * @@ -3382,7 +3384,7 @@ date_s_jd(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3384 * * Raises an exception if +yday+ is zero or out of range. * - * See {Argument start}[rdoc-ref:Date@Argument+start]. + * See argument {start}[rdoc-ref:Date@Argument+start]. * * Related: Date.jd, Date.new. */ @@ -3459,7 +3461,7 @@ date_s_civil(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3461 * where +n+ is the number of days in the month; * when the argument is negative, counts backward from the end of the month. * - * See {Argument start}[rdoc-ref:Date@Argument+start]. + * See argument {start}[rdoc-ref:Date@Argument+start]. * * Date.civil is an alias for Date.new. * @@ -3529,7 +3531,7 @@ date_initialize(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3531 /* * call-seq: - * Date.commercial(cwyear=-4712, cweek=1, cwday=1, start=Date::ITALY) -> date + * Date.commercial(cwyear = -4712, cweek = 1, cwday = 1, start = Date::ITALY) -> date * * Returns a new \Date object constructed from the arguments. * @@ -3567,7 +3569,7 @@ date_initialize(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3569 * Date.commercial(2020, 1, 1).to_s # => "2019-12-30" Date.commercial(2020, 1, 7).to_s # => "2020-01-05" * - * See {Argument start}[rdoc-ref:Date@Argument+start]. + * See argument {start}[rdoc-ref:Date@Argument+start]. * * Related: Date.jd, Date.new, Date.ordinal. */ @@ -3744,11 +3746,14 @@ static void set_sg(union DateData *, double); https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3746 /* * call-seq: - * Date.today([start=Date::ITALY]) -> date + * Date.today(start = Date::ITALY) -> date + * + * Returns a new \Date object constructed from the present date: * - * Creates a date object denoting the present day. + * Date.today.to_s # => "2022-07-06" + * + * See argument {start}[rdoc-ref:Date@Argument+start]. * - * Date.today #=> #<Date: 2011-06-11 ...> */ static VALUE date_s_today(int argc, VALUE *argv, VALUE klass) @@ -4339,7 +4344,7 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass, https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4344 /* * call-seq: - * Date._strptime(string[, format='%F']) -> hash + * Date._strptime(string, format = '%F') -> hash * * Parses the given representation of date and time with the given * template, and returns a hash of parsed elements. _strptime does @@ -4358,7 +4363,7 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4363 /* * call-seq: - * Date.strptime([string='-4712-01-01'[, format='%F'[, start=Date::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 @@ -4372,6 +4377,8 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4377 * Date.strptime('2001 05 6', '%Y %W %u') #=> #<Date: 2001-02-03 ...> * Date.strptime('sat3feb01', '%a%d%b%y') #=> #<Date: 2001-02-03 ...> * + * See argument {start}[rdoc-ref:Date@Argument+start]. + * * See also strptime(3) and #strftime. */ static VALUE @@ -4459,7 +4466,7 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4466 /* * call-seq: - * Date._parse(string[, comp=true], limit: 128) -> hash + * Date._parse(string, comp = true, limit: 128) -> hash * * Parses the given representation of date and time, and returns a * hash of parsed elements. @@ -4487,7 +4494,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4494 /* * call-seq: - * Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]], limit: 128) -> date + * Date.parse(string = '-4712-01-01', comp = true, start = Date::ITALY, limit: 128) -> date * * Parses the given representation of date and time, and creates a * date object. @@ -4508,6 +4515,8 @@ date_s__parse(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4515 * 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. + ^ + * See argument {start}[rdoc-ref:Date@Argument+start]. */ static VALUE date_s_parse(int argc, VALUE *argv, VALUE klass) @@ -4546,7 +4555,7 @@ VALUE date__jisx0301(VALUE); https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4555 /* * call-seq: - * Date._iso8601(string, limit: 128) -> hash + * Date._iso8601(string, limit: 128) -> hash * * Returns a hash of parsed elements. * @@ -4567,7 +4576,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4576 /* * call-seq: - * Date.iso8601(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date + * Date.iso8601(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date * * Creates a new Date object by parsing from a string according to * some typical ISO 8601 formats. @@ -4579,6 +4588,8 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4588 * 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. + * + * See argument {start}[rdoc-ref:Date@Argument+start]. */ static VALUE date_s_iso8601(int argc, VALUE *argv, VALUE klass) @@ -4607,7 +4618,7 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4618 /* * call-seq: - * Date._rfc3339(string, limit: 128) -> hash + * Date._rfc3339(string, limit: 128) -> hash * * Returns a hash of parsed elements. * @@ -4628,7 +4639,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4639 /* * call-seq: - * Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> date + * Date.rfc3339(string = '-4712-01-01T00:00:00+00:00', start = Date::ITALY, limit: 128) -> date * * Creates a new Date object by parsing from a string according to * some typical RFC 3339 formats. @@ -4638,6 +4649,8 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L4649 * 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. (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/