Skip to content

Commit 9aec11d

Browse files
Enhanced RDoc (#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.
1 parent 9d3bc61 commit 9aec11d

File tree

1 file changed

+56
-30
lines changed

1 file changed

+56
-30
lines changed

ext/date/date_core.c

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,6 +2473,8 @@ date_s__valid_jd_p(int argc, VALUE *argv, VALUE klass)
24732473
*
24742474
* Date.valid_jd?(2451944) # => true
24752475
*
2476+
* See argument {start}[rdoc-ref:Date@Argument+start].
2477+
*
24762478
* Related: Date.jd.
24772479
*/
24782480
static VALUE
@@ -2564,7 +2566,7 @@ date_s__valid_civil_p(int argc, VALUE *argv, VALUE klass)
25642566
* Date.valid_date?(2001, 2, 29) # => false
25652567
* Date.valid_date?(2001, 2, -1) # => true
25662568
*
2567-
* See {Argument start}[rdoc-ref:Date@Argument+start].
2569+
* See argument {start}[rdoc-ref:Date@Argument+start].
25682570
*
25692571
* Date.valid_date? is an alias for Date.valid_civil?.
25702572
*
@@ -2653,7 +2655,7 @@ date_s__valid_ordinal_p(int argc, VALUE *argv, VALUE klass)
26532655
* Date.valid_ordinal?(2001, 34) # => true
26542656
* Date.valid_ordinal?(2001, 366) # => false
26552657
*
2656-
* See {Argument start}[rdoc-ref:Date@Argument+start].
2658+
* See argument {start}[rdoc-ref:Date@Argument+start].
26572659
*
26582660
* Related: Date.jd, Date.ordinal.
26592661
*/
@@ -2742,7 +2744,7 @@ date_s__valid_commercial_p(int argc, VALUE *argv, VALUE klass)
27422744
*
27432745
* See Date.commercial.
27442746
*
2745-
* See {Argument start}[rdoc-ref:Date@Argument+start].
2747+
* See argument {start}[rdoc-ref:Date@Argument+start].
27462748
*
27472749
* Related: Date.jd, Date.commercial.
27482750
*/
@@ -3317,7 +3319,7 @@ static VALUE d_lite_plus(VALUE, VALUE);
33173319
*
33183320
* Date.jd(Date::ITALY - 1).julian? # => true
33193321
*
3320-
* See {Argument start}[rdoc-ref:Date@Argument+start].
3322+
* See argument {start}[rdoc-ref:Date@Argument+start].
33213323
*
33223324
* Related: Date.new.
33233325
*/
@@ -3358,7 +3360,7 @@ date_s_jd(int argc, VALUE *argv, VALUE klass)
33583360

33593361
/*
33603362
* call-seq:
3361-
* Date.ordinal(year = -4712, yday = 1, start = Date::ITALY) -> date
3363+
* Date.ordinal(year = -4712, yday = 1, start = Date::ITALY) -> date
33623364
*
33633365
* Returns a new \Date object formed fom the arguments.
33643366
*
@@ -3382,7 +3384,7 @@ date_s_jd(int argc, VALUE *argv, VALUE klass)
33823384
*
33833385
* Raises an exception if +yday+ is zero or out of range.
33843386
*
3385-
* See {Argument start}[rdoc-ref:Date@Argument+start].
3387+
* See argument {start}[rdoc-ref:Date@Argument+start].
33863388
*
33873389
* Related: Date.jd, Date.new.
33883390
*/
@@ -3459,7 +3461,7 @@ date_s_civil(int argc, VALUE *argv, VALUE klass)
34593461
* where +n+ is the number of days in the month;
34603462
* when the argument is negative, counts backward from the end of the month.
34613463
*
3462-
* See {Argument start}[rdoc-ref:Date@Argument+start].
3464+
* See argument {start}[rdoc-ref:Date@Argument+start].
34633465
*
34643466
* Date.civil is an alias for Date.new.
34653467
*
@@ -3529,7 +3531,7 @@ date_initialize(int argc, VALUE *argv, VALUE self)
35293531

35303532
/*
35313533
* call-seq:
3532-
* Date.commercial(cwyear=-4712, cweek=1, cwday=1, start=Date::ITALY) -> date
3534+
* Date.commercial(cwyear = -4712, cweek = 1, cwday = 1, start = Date::ITALY) -> date
35333535
*
35343536
* Returns a new \Date object constructed from the arguments.
35353537
*
@@ -3567,7 +3569,7 @@ date_initialize(int argc, VALUE *argv, VALUE self)
35673569
* Date.commercial(2020, 1, 1).to_s # => "2019-12-30"
35683570
Date.commercial(2020, 1, 7).to_s # => "2020-01-05"
35693571
*
3570-
* See {Argument start}[rdoc-ref:Date@Argument+start].
3572+
* See argument {start}[rdoc-ref:Date@Argument+start].
35713573
*
35723574
* Related: Date.jd, Date.new, Date.ordinal.
35733575
*/
@@ -3744,11 +3746,14 @@ static void set_sg(union DateData *, double);
37443746

37453747
/*
37463748
* call-seq:
3747-
* Date.today([start=Date::ITALY]) -> date
3749+
* Date.today(start = Date::ITALY) -> date
3750+
*
3751+
* Returns a new \Date object constructed from the present date:
37483752
*
3749-
* Creates a date object denoting the present day.
3753+
* Date.today.to_s # => "2022-07-06"
3754+
*
3755+
* See argument {start}[rdoc-ref:Date@Argument+start].
37503756
*
3751-
* Date.today #=> #<Date: 2011-06-11 ...>
37523757
*/
37533758
static VALUE
37543759
date_s_today(int argc, VALUE *argv, VALUE klass)
@@ -4339,7 +4344,7 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass,
43394344

43404345
/*
43414346
* call-seq:
4342-
* Date._strptime(string[, format='%F']) -> hash
4347+
* Date._strptime(string, format = '%F') -> hash
43434348
*
43444349
* Parses the given representation of date and time with the given
43454350
* template, and returns a hash of parsed elements. _strptime does
@@ -4358,7 +4363,7 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
43584363

43594364
/*
43604365
* call-seq:
4361-
* Date.strptime([string='-4712-01-01'[, format='%F'[, start=Date::ITALY]]]) -> date
4366+
* Date.strptime(string = '-4712-01-01', format = '%F', start = Date::ITALY) -> date
43624367
*
43634368
* Parses the given representation of date and time with the given
43644369
* template, and creates a date object. strptime does not support
@@ -4372,6 +4377,8 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
43724377
* Date.strptime('2001 05 6', '%Y %W %u') #=> #<Date: 2001-02-03 ...>
43734378
* Date.strptime('sat3feb01', '%a%d%b%y') #=> #<Date: 2001-02-03 ...>
43744379
*
4380+
* See argument {start}[rdoc-ref:Date@Argument+start].
4381+
*
43754382
* See also strptime(3) and #strftime.
43764383
*/
43774384
static VALUE
@@ -4459,7 +4466,7 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
44594466

44604467
/*
44614468
* call-seq:
4462-
* Date._parse(string[, comp=true], limit: 128) -> hash
4469+
* Date._parse(string, comp = true, limit: 128) -> hash
44634470
*
44644471
* Parses the given representation of date and time, and returns a
44654472
* hash of parsed elements.
@@ -4487,7 +4494,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
44874494

44884495
/*
44894496
* call-seq:
4490-
* Date.parse(string='-4712-01-01'[, comp=true[, start=Date::ITALY]], limit: 128) -> date
4497+
* Date.parse(string = '-4712-01-01', comp = true, start = Date::ITALY, limit: 128) -> date
44914498
*
44924499
* Parses the given representation of date and time, and creates a
44934500
* date object.
@@ -4508,6 +4515,8 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
45084515
* Raise an ArgumentError when the string length is longer than _limit_.
45094516
* You can stop this check by passing `limit: nil`, but note that
45104517
* it may take a long time to parse.
4518+
^
4519+
* See argument {start}[rdoc-ref:Date@Argument+start].
45114520
*/
45124521
static VALUE
45134522
date_s_parse(int argc, VALUE *argv, VALUE klass)
@@ -4546,7 +4555,7 @@ VALUE date__jisx0301(VALUE);
45464555

45474556
/*
45484557
* call-seq:
4549-
* Date._iso8601(string, limit: 128) -> hash
4558+
* Date._iso8601(string, limit: 128) -> hash
45504559
*
45514560
* Returns a hash of parsed elements.
45524561
*
@@ -4567,7 +4576,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
45674576

45684577
/*
45694578
* call-seq:
4570-
* Date.iso8601(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
4579+
* Date.iso8601(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
45714580
*
45724581
* Creates a new Date object by parsing from a string according to
45734582
* some typical ISO 8601 formats.
@@ -4579,6 +4588,8 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
45794588
* Raise an ArgumentError when the string length is longer than _limit_.
45804589
* You can stop this check by passing `limit: nil`, but note that
45814590
* it may take a long time to parse.
4591+
*
4592+
* See argument {start}[rdoc-ref:Date@Argument+start].
45824593
*/
45834594
static VALUE
45844595
date_s_iso8601(int argc, VALUE *argv, VALUE klass)
@@ -4607,7 +4618,7 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass)
46074618

46084619
/*
46094620
* call-seq:
4610-
* Date._rfc3339(string, limit: 128) -> hash
4621+
* Date._rfc3339(string, limit: 128) -> hash
46114622
*
46124623
* Returns a hash of parsed elements.
46134624
*
@@ -4628,7 +4639,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
46284639

46294640
/*
46304641
* call-seq:
4631-
* Date.rfc3339(string='-4712-01-01T00:00:00+00:00'[, start=Date::ITALY], limit: 128) -> date
4642+
* Date.rfc3339(string = '-4712-01-01T00:00:00+00:00', start = Date::ITALY, limit: 128) -> date
46324643
*
46334644
* Creates a new Date object by parsing from a string according to
46344645
* some typical RFC 3339 formats.
@@ -4638,6 +4649,8 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
46384649
* Raise an ArgumentError when the string length is longer than _limit_.
46394650
* You can stop this check by passing `limit: nil`, but note that
46404651
* it may take a long time to parse.
4652+
*
4653+
* See argument {start}[rdoc-ref:Date@Argument+start].
46414654
*/
46424655
static VALUE
46434656
date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
@@ -4666,7 +4679,7 @@ date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
46664679

46674680
/*
46684681
* call-seq:
4669-
* Date._xmlschema(string, limit: 128) -> hash
4682+
* Date._xmlschema(string, limit: 128) -> hash
46704683
*
46714684
* Returns a hash of parsed elements.
46724685
*
@@ -4687,7 +4700,7 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
46874700

46884701
/*
46894702
* call-seq:
4690-
* Date.xmlschema(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
4703+
* Date.xmlschema(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
46914704
*
46924705
* Creates a new Date object by parsing from a string according to
46934706
* some typical XML Schema formats.
@@ -4697,6 +4710,9 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
46974710
* Raise an ArgumentError when the string length is longer than _limit_.
46984711
* You can stop this check by passing `limit: nil`, but note that
46994712
* it may take a long time to parse.
4713+
*
4714+
* See argument {start}[rdoc-ref:Date@Argument+start].
4715+
*
47004716
*/
47014717
static VALUE
47024718
date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
@@ -4725,14 +4741,15 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
47254741

47264742
/*
47274743
* call-seq:
4728-
* Date._rfc2822(string, limit: 128) -> hash
4729-
* Date._rfc822(string, limit: 128) -> hash
4744+
* Date._rfc2822(string, limit: 128) -> hash
47304745
*
47314746
* Returns a hash of parsed elements.
47324747
*
47334748
* Raise an ArgumentError when the string length is longer than _limit_.
47344749
* You can stop this check by passing `limit: nil`, but note that
47354750
* it may take a long time to parse.
4751+
*
4752+
* Date._rfc822 is an alias for Date._rfc2822.
47364753
*/
47374754
static VALUE
47384755
date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
@@ -4747,8 +4764,7 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
47474764

47484765
/*
47494766
* call-seq:
4750-
* Date.rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
4751-
* Date.rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) -> date
4767+
* Date.rfc2822(string = 'Mon, 1 Jan -4712 00:00:00 +0000', start = Date::ITALY, limit: 128) -> date
47524768
*
47534769
* Creates a new Date object by parsing from a string according to
47544770
* some typical RFC 2822 formats.
@@ -4759,6 +4775,10 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
47594775
* Raise an ArgumentError when the string length is longer than _limit_.
47604776
* You can stop this check by passing `limit: nil`, but note that
47614777
* it may take a long time to parse.
4778+
*
4779+
* See argument {start}[rdoc-ref:Date@Argument+start].
4780+
*
4781+
* Date.rfc822 is an alias for Date.rfc2822.
47624782
*/
47634783
static VALUE
47644784
date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
@@ -4786,7 +4806,7 @@ date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
47864806

47874807
/*
47884808
* call-seq:
4789-
* Date._httpdate(string, limit: 128) -> hash
4809+
* Date._httpdate(string, limit: 128) -> hash
47904810
*
47914811
* Returns a hash of parsed elements.
47924812
*
@@ -4807,7 +4827,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
48074827

48084828
/*
48094829
* call-seq:
4810-
* Date.httpdate(string='Mon, 01 Jan -4712 00:00:00 GMT'[, start=Date::ITALY], limit: 128) -> date
4830+
* Date.httpdate(string = 'Mon, 01 Jan -4712 00:00:00 GMT', start = Date::ITALY, limit: 128) -> date
48114831
*
48124832
* Creates a new Date object by parsing from a string according to
48134833
* some RFC 2616 format.
@@ -4818,6 +4838,9 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
48184838
* Raise an ArgumentError when the string length is longer than _limit_.
48194839
* You can stop this check by passing `limit: nil`, but note that
48204840
* it may take a long time to parse.
4841+
*
4842+
* See argument {start}[rdoc-ref:Date@Argument+start].
4843+
*
48214844
*/
48224845
static VALUE
48234846
date_s_httpdate(int argc, VALUE *argv, VALUE klass)
@@ -4845,7 +4868,7 @@ date_s_httpdate(int argc, VALUE *argv, VALUE klass)
48454868

48464869
/*
48474870
* call-seq:
4848-
* Date._jisx0301(string, limit: 128) -> hash
4871+
* Date._jisx0301(string, limit: 128) -> hash
48494872
*
48504873
* Returns a hash of parsed elements.
48514874
*
@@ -4866,7 +4889,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
48664889

48674890
/*
48684891
* call-seq:
4869-
* Date.jisx0301(string='-4712-01-01'[, start=Date::ITALY], limit: 128) -> date
4892+
* Date.jisx0301(string = '-4712-01-01', start = Date::ITALY, limit: 128) -> date
48704893
*
48714894
* Creates a new Date object by parsing from a string according to
48724895
* some typical JIS X 0301 formats.
@@ -4880,6 +4903,9 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
48804903
* Raise an ArgumentError when the string length is longer than _limit_.
48814904
* You can stop this check by passing `limit: nil`, but note that
48824905
* it may take a long time to parse.
4906+
*
4907+
* See argument {start}[rdoc-ref:Date@Argument+start].
4908+
*
48834909
*/
48844910
static VALUE
48854911
date_s_jisx0301(int argc, VALUE *argv, VALUE klass)

0 commit comments

Comments
 (0)