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
This commit is contained in:
Burdette Lamar 2022-07-07 13:47:55 -05:00 committed by git
parent 55c5bf27f5
commit 621e5c568a

View File

@ -2473,6 +2473,8 @@ date_s__valid_jd_p(int argc, VALUE *argv, VALUE klass)
* *
* Date.valid_jd?(2451944) # => true * Date.valid_jd?(2451944) # => true
* *
* See argument {start}[rdoc-ref:Date@Argument+start].
*
* Related: Date.jd. * Related: Date.jd.
*/ */
static VALUE static VALUE
@ -2564,7 +2566,7 @@ date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass)
* Date.valid_date?(2001, 2, 29) # => false * Date.valid_date?(2001, 2, 29) # => false
* Date.valid_date?(2001, 2, -1) # => true * 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?. * 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)
* Date.valid_ordinal?(2001, 34) # => true * Date.valid_ordinal?(2001, 34) # => true
* Date.valid_ordinal?(2001, 366) # => false * 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. * Related: Date.jd, Date.ordinal.
*/ */
@ -2742,7 +2744,7 @@ date_s__valid_commercial_p(int argc, VALUE *argv, VALUE klass)
* *
* See Date.commercial. * See Date.commercial.
* *
* See {Argument start}[rdoc-ref:Date@Argument+start]. * See argument {start}[rdoc-ref:Date@Argument+start].
* *
* Related: Date.jd, Date.commercial. * Related: Date.jd, Date.commercial.
*/ */
@ -3317,7 +3319,7 @@ static VALUE d_lite_plus(VALUE, VALUE);
* *
* Date.jd(Date::ITALY - 1).julian? # => true * 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. * Related: Date.new.
*/ */
@ -3382,7 +3384,7 @@ date_s_jd(int argc, VALUE *argv, VALUE klass)
* *
* Raises an exception if +yday+ is zero or out of range. * 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. * Related: Date.jd, Date.new.
*/ */
@ -3459,7 +3461,7 @@ date_s_civil(int argc, VALUE *argv, VALUE klass)
* where +n+ is the number of days in the month; * where +n+ is the number of days in the month;
* when the argument is negative, counts backward from the end of 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. * Date.civil is an alias for Date.new.
* *
@ -3529,7 +3531,7 @@ date_initialize(int argc, VALUE *argv, VALUE self)
/* /*
* call-seq: * 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. * Returns a new \Date object constructed from the arguments.
* *
@ -3567,7 +3569,7 @@ date_initialize(int argc, VALUE *argv, VALUE self)
* Date.commercial(2020, 1, 1).to_s # => "2019-12-30" * Date.commercial(2020, 1, 1).to_s # => "2019-12-30"
Date.commercial(2020, 1, 7).to_s # => "2020-01-05" 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. * Related: Date.jd, Date.new, Date.ordinal.
*/ */
@ -3744,11 +3746,14 @@ static void set_sg(union DateData *, double);
/* /*
* call-seq: * call-seq:
* Date.today([start=Date::ITALY]) -> date * Date.today(start = Date::ITALY) -> date
* *
* Creates a date object denoting the present day. * Returns a new \Date object constructed from the present date:
*
* Date.today.to_s # => "2022-07-06"
*
* See argument {start}[rdoc-ref:Date@Argument+start].
* *
* Date.today #=> #<Date: 2011-06-11 ...>
*/ */
static VALUE static VALUE
date_s_today(int argc, VALUE *argv, VALUE klass) date_s_today(int argc, VALUE *argv, VALUE klass)
@ -4339,7 +4344,7 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass,
/* /*
* call-seq: * 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 * Parses the given representation of date and time with the given
* template, and returns a hash of parsed elements. _strptime does * template, and returns a hash of parsed elements. _strptime does
@ -4358,7 +4363,7 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * 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 * Parses the given representation of date and time with the given
* template, and creates a date object. strptime does not support * template, and creates a date object. strptime does not support
@ -4372,6 +4377,8 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
* Date.strptime('2001 05 6', '%Y %W %u') #=> #<Date: 2001-02-03 ...> * Date.strptime('2001 05 6', '%Y %W %u') #=> #<Date: 2001-02-03 ...>
* Date.strptime('sat3feb01', '%a%d%b%y') #=> #<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. * See also strptime(3) and #strftime.
*/ */
static VALUE static VALUE
@ -4459,7 +4466,7 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * 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 * Parses the given representation of date and time, and returns a
* hash of parsed elements. * hash of parsed elements.
@ -4487,7 +4494,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * 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 * Parses the given representation of date and time, and creates a
* date object. * date object.
@ -4508,6 +4515,8 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
* Raise an ArgumentError when the string length is longer than _limit_. * Raise an ArgumentError when the string length is longer than _limit_.
* You can stop this check by passing `limit: nil`, but note that * You can stop this check by passing `limit: nil`, but note that
* it may take a long time to parse. * it may take a long time to parse.
^
* See argument {start}[rdoc-ref:Date@Argument+start].
*/ */
static VALUE static VALUE
date_s_parse(int argc, VALUE *argv, VALUE klass) date_s_parse(int argc, VALUE *argv, VALUE klass)
@ -4567,7 +4576,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * 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 * Creates a new Date object by parsing from a string according to
* some typical ISO 8601 formats. * some typical ISO 8601 formats.
@ -4579,6 +4588,8 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
* Raise an ArgumentError when the string length is longer than _limit_. * Raise an ArgumentError when the string length is longer than _limit_.
* You can stop this check by passing `limit: nil`, but note that * You can stop this check by passing `limit: nil`, but note that
* it may take a long time to parse. * it may take a long time to parse.
*
* See argument {start}[rdoc-ref:Date@Argument+start].
*/ */
static VALUE static VALUE
date_s_iso8601(int argc, VALUE *argv, VALUE klass) date_s_iso8601(int argc, VALUE *argv, VALUE klass)
@ -4628,7 +4639,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * 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 * Creates a new Date object by parsing from a string according to
* some typical RFC 3339 formats. * some typical RFC 3339 formats.
@ -4638,6 +4649,8 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
* Raise an ArgumentError when the string length is longer than _limit_. * Raise an ArgumentError when the string length is longer than _limit_.
* You can stop this check by passing `limit: nil`, but note that * You can stop this check by passing `limit: nil`, but note that
* it may take a long time to parse. * it may take a long time to parse.
*
* See argument {start}[rdoc-ref:Date@Argument+start].
*/ */
static VALUE static VALUE
date_s_rfc3339(int argc, VALUE *argv, VALUE klass) date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
@ -4687,7 +4700,7 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * call-seq:
* Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date * Date.xmlschema(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
* *
* Creates a new Date object by parsing from a string according to * Creates a new Date object by parsing from a string according to
* some typical XML Schema formats. * some typical XML Schema formats.
@ -4697,6 +4710,9 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
* Raise an ArgumentError when the string length is longer than _limit_. * Raise an ArgumentError when the string length is longer than _limit_.
* You can stop this check by passing `limit: nil`, but note that * You can stop this check by passing `limit: nil`, but note that
* it may take a long time to parse. * it may take a long time to parse.
*
* See argument {start}[rdoc-ref:Date@Argument+start].
*
*/ */
static VALUE static VALUE
date_s_xmlschema(int argc, VALUE *argv, VALUE klass) date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
@ -4726,13 +4742,14 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * call-seq:
* Date._rfc2822(string, limit: 128) -> hash * Date._rfc2822(string, limit: 128) -> hash
* Date._rfc822(string, limit: 128) -> hash
* *
* Returns a hash of parsed elements. * Returns a hash of parsed elements.
* *
* Raise an ArgumentError when the string length is longer than _limit_. * Raise an ArgumentError when the string length is longer than _limit_.
* You can stop this check by passing `limit: nil`, but note that * You can stop this check by passing `limit: nil`, but note that
* it may take a long time to parse. * it may take a long time to parse.
*
* Date._rfc822 is an alias for Date._rfc2822.
*/ */
static VALUE static VALUE
date_s__rfc2822(int argc, VALUE *argv, VALUE klass) date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
@ -4747,8 +4764,7 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * call-seq:
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date * Date.rfc2822(string = 'Mon, 1 Jan -4712 00:00:00 +0000', start = Date::ITALY, limit: 128) -> date
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
* *
* Creates a new Date object by parsing from a string according to * Creates a new Date object by parsing from a string according to
* some typical RFC 2822 formats. * some typical RFC 2822 formats.
@ -4759,6 +4775,10 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
* Raise an ArgumentError when the string length is longer than _limit_. * Raise an ArgumentError when the string length is longer than _limit_.
* You can stop this check by passing `limit: nil`, but note that * You can stop this check by passing `limit: nil`, but note that
* it may take a long time to parse. * it may take a long time to parse.
*
* See argument {start}[rdoc-ref:Date@Argument+start].
*
* Date.rfc822 is an alias for Date.rfc2822.
*/ */
static VALUE static VALUE
date_s_rfc2822(int argc, VALUE *argv, VALUE klass) date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
@ -4807,7 +4827,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * call-seq:
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY], limit: 128) -> date * Date.httpdate(string = 'Mon, 01 Jan -4712 00:00:00 GMT', start = Date::ITALY, limit: 128) -> date
* *
* Creates a new Date object by parsing from a string according to * Creates a new Date object by parsing from a string according to
* some RFC 2616 format. * some RFC 2616 format.
@ -4818,6 +4838,9 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
* Raise an ArgumentError when the string length is longer than _limit_. * Raise an ArgumentError when the string length is longer than _limit_.
* You can stop this check by passing `limit: nil`, but note that * You can stop this check by passing `limit: nil`, but note that
* it may take a long time to parse. * it may take a long time to parse.
*
* See argument {start}[rdoc-ref:Date@Argument+start].
*
*/ */
static VALUE static VALUE
date_s_httpdate(int argc, VALUE *argv, VALUE klass) date_s_httpdate(int argc, VALUE *argv, VALUE klass)
@ -4866,7 +4889,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
/* /*
* call-seq: * call-seq:
* Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date * Date.jisx0301(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
* *
* Creates a new Date object by parsing from a string according to * Creates a new Date object by parsing from a string according to
* some typical JIS X 0301 formats. * some typical JIS X 0301 formats.
@ -4880,6 +4903,9 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
* Raise an ArgumentError when the string length is longer than _limit_. * Raise an ArgumentError when the string length is longer than _limit_.
* You can stop this check by passing `limit: nil`, but note that * You can stop this check by passing `limit: nil`, but note that
* it may take a long time to parse. * it may take a long time to parse.
*
* See argument {start}[rdoc-ref:Date@Argument+start].
*
*/ */
static VALUE static VALUE
date_s_jisx0301(int argc, VALUE *argv, VALUE klass) date_s_jisx0301(int argc, VALUE *argv, VALUE klass)