Skip to content

Commit a6c2129

Browse files
Enhanced RDoc (#69)
Treats: ::_strptime ::strptime Adds 'Related' entry to some methods' doc.
1 parent 24bdab6 commit a6c2129

File tree

1 file changed

+46
-17
lines changed

1 file changed

+46
-17
lines changed

ext/date/date_core.c

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4371,14 +4371,18 @@ date_s__strptime_internal(int argc, VALUE *argv, VALUE klass,
43714371
* call-seq:
43724372
* Date._strptime(string, format = '%F') -> hash
43734373
*
4374-
* Parses the given representation of date and time with the given
4375-
* template, and returns a hash of parsed elements. _strptime does
4376-
* not support specification of flags and width unlike strftime.
4374+
* Returns a hash of values parsed from +string+
4375+
* according to the given +format+:
43774376
*
4378-
* Date._strptime('2001-02-03', '%Y-%m-%d')
4379-
* #=> {:year=>2001, :mon=>2, :mday=>3}
4377+
* Date._strptime('2001-02-03', '%Y-%m-%d') # => {:year=>2001, :mon=>2, :mday=>3}
43804378
*
4381-
* See also strptime(3) and #strftime.
4379+
* For other formats, see
4380+
* {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html].
4381+
* (Unlike Date.strftime, does not support flags and width.)
4382+
*
4383+
* See also {strptime(3)}[https://man7.org/linux/man-pages/man3/strptime.3.html].
4384+
*
4385+
* Related: Date.strptime (returns a \Date object).
43824386
*/
43834387
static VALUE
43844388
date_s__strptime(int argc, VALUE *argv, VALUE klass)
@@ -4390,21 +4394,26 @@ date_s__strptime(int argc, VALUE *argv, VALUE klass)
43904394
* call-seq:
43914395
* Date.strptime(string = '-4712-01-01', format = '%F', start = Date::ITALY) -> date
43924396
*
4393-
* Parses the given representation of date and time with the given
4394-
* template, and creates a date object. strptime does not support
4395-
* specification of flags and width unlike strftime.
4397+
* Returns a new \Date object with values parsed from +string+,
4398+
* according to the given +format+:
43964399
*
4397-
* Date.strptime('2001-02-03', '%Y-%m-%d') #=> #<Date: 2001-02-03 ...>
4398-
* Date.strptime('03-02-2001', '%d-%m-%Y') #=> #<Date: 2001-02-03 ...>
4399-
* Date.strptime('2001-034', '%Y-%j') #=> #<Date: 2001-02-03 ...>
4400-
* Date.strptime('2001-W05-6', '%G-W%V-%u') #=> #<Date: 2001-02-03 ...>
4401-
* Date.strptime('2001 04 6', '%Y %U %w') #=> #<Date: 2001-02-03 ...>
4402-
* Date.strptime('2001 05 6', '%Y %W %u') #=> #<Date: 2001-02-03 ...>
4403-
* Date.strptime('sat3feb01', '%a%d%b%y') #=> #<Date: 2001-02-03 ...>
4400+
* Date.strptime('2001-02-03', '%Y-%m-%d') # => #<Date: 2001-02-03>
4401+
* Date.strptime('03-02-2001', '%d-%m-%Y') # => #<Date: 2001-02-03>
4402+
* Date.strptime('2001-034', '%Y-%j') # => #<Date: 2001-02-03>
4403+
* Date.strptime('2001-W05-6', '%G-W%V-%u') # => #<Date: 2001-02-03>
4404+
* Date.strptime('2001 04 6', '%Y %U %w') # => #<Date: 2001-02-03>
4405+
* Date.strptime('2001 05 6', '%Y %W %u') # => #<Date: 2001-02-03>
4406+
* Date.strptime('sat3feb01', '%a%d%b%y') # => #<Date: 2001-02-03>
4407+
*
4408+
* For other formats, see
4409+
* {Formats for Dates and Times}[https://docs.ruby-lang.org/en/master/strftime_formatting_rdoc.html].
4410+
* (Unlike Date.strftime, does not support flags and width.)
44044411
*
44054412
* See argument {start}[rdoc-ref:Date@Argument+start].
44064413
*
4407-
* See also strptime(3) and #strftime.
4414+
* See also {strptime(3)}[https://man7.org/linux/man-pages/man3/strptime.3.html].
4415+
*
4416+
* Related: Date._strptime (returns a hash).
44084417
*/
44094418
static VALUE
44104419
date_s_strptime(int argc, VALUE *argv, VALUE klass)
@@ -4513,6 +4522,7 @@ date_s__parse_internal(int argc, VALUE *argv, VALUE klass)
45134522
*
45144523
* See argument {limit}[rdoc-ref:Date@Argument+limit].
45154524
*
4525+
* Related: Date.parse(returns a \Date object).
45164526
*/
45174527
static VALUE
45184528
date_s__parse(int argc, VALUE *argv, VALUE klass)
@@ -4549,6 +4559,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
45494559
* - Argument {start}[rdoc-ref:Date@Argument+start].
45504560
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
45514561
*
4562+
* Related: Date._parse (returns a hash).
45524563
*/
45534564
static VALUE
45544565
date_s_parse(int argc, VALUE *argv, VALUE klass)
@@ -4597,6 +4608,8 @@ VALUE date__jisx0301(VALUE);
45974608
* Date._iso8601(s) # => {:mday=>3, :year=>2001, :mon=>2}
45984609
*
45994610
* See argument {limit}[rdoc-ref:Date@Argument+limit].
4611+
*
4612+
* Related: Date.iso8601 (returns a \Date object).
46004613
*/
46014614
static VALUE
46024615
date_s__iso8601(int argc, VALUE *argv, VALUE klass)
@@ -4626,6 +4639,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
46264639
* - Argument {start}[rdoc-ref:Date@Argument+start].
46274640
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
46284641
*
4642+
* Related: Date._iso8601 (returns a hash).
46294643
*/
46304644
static VALUE
46314645
date_s_iso8601(int argc, VALUE *argv, VALUE klass)
@@ -4665,6 +4679,8 @@ date_s_iso8601(int argc, VALUE *argv, VALUE klass)
46654679
* # => {:year=>2001, :mon=>2, :mday=>3, :hour=>0, :min=>0, :sec=>0, :zone=>"+00:00", :offset=>0}
46664680
*
46674681
* See argument {limit}[rdoc-ref:Date@Argument+limit].
4682+
*
4683+
* Related: Date.rfc3339 (returns a \Date object).
46684684
*/
46694685
static VALUE
46704686
date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
@@ -4694,6 +4710,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
46944710
* - Argument {start}[rdoc-ref:Date@Argument+start].
46954711
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
46964712
*
4713+
* Related: Date._rfc3339 (returns a hash).
46974714
*/
46984715
static VALUE
46994716
date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
@@ -4732,6 +4749,8 @@ date_s_rfc3339(int argc, VALUE *argv, VALUE klass)
47324749
* Date._xmlschema(s) # => {:year=>2001, :mon=>2, :mday=>3}
47334750
*
47344751
* See argument {limit}[rdoc-ref:Date@Argument+limit].
4752+
*
4753+
* Related: Date.xmlschema (returns a \Date object).
47354754
*/
47364755
static VALUE
47374756
date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
@@ -4760,6 +4779,7 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
47604779
* - Argument {start}[rdoc-ref:Date@Argument+start].
47614780
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
47624781
*
4782+
* Related: Date._xmlschema (returns a hash).
47634783
*/
47644784
static VALUE
47654785
date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
@@ -4801,6 +4821,8 @@ date_s_xmlschema(int argc, VALUE *argv, VALUE klass)
48014821
* See argument {limit}[rdoc-ref:Date@Argument+limit].
48024822
*
48034823
* Date._rfc822 is an alias for Date._rfc2822.
4824+
*
4825+
* Related: Date.rfc2822 (returns a \Date object).
48044826
*/
48054827
static VALUE
48064828
date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
@@ -4831,6 +4853,8 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
48314853
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
48324854
*
48334855
* Date.rfc822 is an alias for Date.rfc2822.
4856+
*
4857+
* Related: Date._rfc2822 (returns a hash).
48344858
*/
48354859
static VALUE
48364860
date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
@@ -4868,6 +4892,7 @@ date_s_rfc2822(int argc, VALUE *argv, VALUE klass)
48684892
* Date._httpdate(s)
48694893
* # => {:wday=>6, :mday=>3, :mon=>2, :year=>2001, :hour=>0, :min=>0, :sec=>0, :zone=>"GMT", :offset=>0}
48704894
*
4895+
* Related: Date.httpdate (returns a \Date object).
48714896
*/
48724897
static VALUE
48734898
date_s__httpdate(int argc, VALUE *argv, VALUE klass)
@@ -4897,6 +4922,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
48974922
* - Argument {start}[rdoc-ref:Date@Argument+start].
48984923
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
48994924
*
4925+
* Related: Date._httpdate (returns a hash).
49004926
*/
49014927
static VALUE
49024928
date_s_httpdate(int argc, VALUE *argv, VALUE klass)
@@ -4934,6 +4960,8 @@ date_s_httpdate(int argc, VALUE *argv, VALUE klass)
49344960
* Date._jisx0301(s) # => {:year=>2001, :mon=>2, :mday=>3}
49354961
*
49364962
* See argument {limit}[rdoc-ref:Date@Argument+limit].
4963+
*
4964+
* Related: Date.jisx0301 (returns a \Date object).
49374965
*/
49384966
static VALUE
49394967
date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
@@ -4966,6 +4994,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
49664994
* - Argument {start}[rdoc-ref:Date@Argument+start].
49674995
* - Argument {limit}[rdoc-ref:Date@Argument+limit].
49684996
*
4997+
* Related: Date._jisx0301 (returns a hash).
49694998
*/
49704999
static VALUE
49715000
date_s_jisx0301(int argc, VALUE *argv, VALUE klass)

0 commit comments

Comments
 (0)