Skip to content

Commit 00e37ba

Browse files
[DOC] Enhanced RDoc (#59)
Minor changes (mostly doc-guide compliance) to 18 or so of simpler methods (getters).
1 parent 9aec11d commit 00e37ba

File tree

1 file changed

+69
-55
lines changed

1 file changed

+69
-55
lines changed

ext/date/date_core.c

Lines changed: 69 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4515,7 +4515,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass)
45154515
* Raise an ArgumentError when the string length is longer than _limit_.
45164516
* You can stop this check by passing `limit: nil`, but note that
45174517
* it may take a long time to parse.
4518-
^
4518+
*
45194519
* See argument {start}[rdoc-ref:Date@Argument+start].
45204520
*/
45214521
static VALUE
@@ -5186,12 +5186,15 @@ d_lite_mjd(VALUE self)
51865186

51875187
/*
51885188
* call-seq:
5189-
* d.ld -> integer
5189+
* ld -> integer
51905190
*
5191-
* Returns the Lilian day number. This is a whole number, which is
5192-
* adjusted by the offset as the local time.
5191+
* Returns the
5192+
* {Lilian day number}[https://en.wikipedia.org/wiki/Lilian_date],
5193+
* which is the number of days since the beginning of the Gregorian
5194+
* calendar, October 15, 1582.
5195+
*
5196+
* Date.new(2001, 2, 3).ld # => 152784
51935197
*
5194-
* Date.new(2001,2,3).ld #=> 152784
51955198
*/
51965199
static VALUE
51975200
d_lite_ld(VALUE self)
@@ -5202,12 +5205,13 @@ d_lite_ld(VALUE self)
52025205

52035206
/*
52045207
* call-seq:
5205-
* d.year -> integer
5208+
* year -> integer
5209+
*
5210+
* Returns the year:
52065211
*
5207-
* Returns the year.
5212+
* Date.new(2001, 2, 3).year # => 2001
5213+
* (Date.new(1, 1, 1) - 1).year # => 0
52085214
*
5209-
* Date.new(2001,2,3).year #=> 2001
5210-
* (Date.new(1,1,1) - 1).year #=> 0
52115215
*/
52125216
static VALUE
52135217
d_lite_year(VALUE self)
@@ -5218,11 +5222,12 @@ d_lite_year(VALUE self)
52185222

52195223
/*
52205224
* call-seq:
5221-
* d.yday -> fixnum
5225+
* yday -> integer
52225226
*
5223-
* Returns the day of the year (1-366).
5227+
* Returns the day of the year, in range (1..366):
5228+
*
5229+
* Date.new(2001, 2, 3).yday # => 34
52245230
*
5225-
* Date.new(2001,2,3).yday #=> 34
52265231
*/
52275232
static VALUE
52285233
d_lite_yday(VALUE self)
@@ -5233,12 +5238,13 @@ d_lite_yday(VALUE self)
52335238

52345239
/*
52355240
* call-seq:
5236-
* d.mon -> fixnum
5237-
* d.month -> fixnum
5241+
* mon -> integer
5242+
*
5243+
* Returns the month in range (1..12):
52385244
*
5239-
* Returns the month (1-12).
5245+
* Date.new(2001, 2, 3).mon # => 2
52405246
*
5241-
* Date.new(2001,2,3).mon #=> 2
5247+
* Date#month is an alias for Date#mon.
52425248
*/
52435249
static VALUE
52445250
d_lite_mon(VALUE self)
@@ -5249,12 +5255,13 @@ d_lite_mon(VALUE self)
52495255

52505256
/*
52515257
* call-seq:
5252-
* d.mday -> fixnum
5253-
* d.day -> fixnum
5258+
* mday -> integer
5259+
*
5260+
* Returns the day of the month in range (1..31):
52545261
*
5255-
* Returns the day of the month (1-31).
5262+
* Date.new(2001, 2, 3).mday # => 3
52565263
*
5257-
* Date.new(2001,2,3).mday #=> 3
5264+
* Date#day is an alias for Date#mday.
52585265
*/
52595266
static VALUE
52605267
d_lite_mday(VALUE self)
@@ -5265,11 +5272,12 @@ d_lite_mday(VALUE self)
52655272

52665273
/*
52675274
* call-seq:
5268-
* d.day_fraction -> rational
5275+
* day_fraction -> rational
52695276
*
5270-
* Returns the fractional part of the day.
5277+
* Returns the fractional part of the day in range (Rational(0, 1)...Rational(1, 1)):
5278+
*
5279+
* DateTime.new(2001,2,3,12).day_fraction # => (1/2)
52715280
*
5272-
* DateTime.new(2001,2,3,12).day_fraction #=> (1/2)
52735281
*/
52745282
static VALUE
52755283
d_lite_day_fraction(VALUE self)
@@ -5351,11 +5359,12 @@ d_lite_wnum1(VALUE self)
53515359

53525360
/*
53535361
* call-seq:
5354-
* d.wday -> fixnum
5362+
* wday -> integer
5363+
*
5364+
* Returns the day of week in range (0..6); Sunday is 0:
53555365
*
5356-
* Returns the day of week (0-6, Sunday is zero).
5366+
* Date.new(2001, 2, 3).wday # => 6
53575367
*
5358-
* Date.new(2001,2,3).wday #=> 6
53595368
*/
53605369
static VALUE
53615370
d_lite_wday(VALUE self)
@@ -5366,9 +5375,9 @@ d_lite_wday(VALUE self)
53665375

53675376
/*
53685377
* call-seq:
5369-
* d.sunday? -> bool
5378+
* sunday? -> true or false
53705379
*
5371-
* Returns true if the date is Sunday.
5380+
* Returns +true+ if +self+ is a Sunday, +false+ otherwise.
53725381
*/
53735382
static VALUE
53745383
d_lite_sunday_p(VALUE self)
@@ -5379,9 +5388,9 @@ d_lite_sunday_p(VALUE self)
53795388

53805389
/*
53815390
* call-seq:
5382-
* d.monday? -> bool
5391+
* monday? -> true or false
53835392
*
5384-
* Returns true if the date is Monday.
5393+
* Returns +true+ if +self+ is a Monday, +false+ otherwise.
53855394
*/
53865395
static VALUE
53875396
d_lite_monday_p(VALUE self)
@@ -5392,9 +5401,9 @@ d_lite_monday_p(VALUE self)
53925401

53935402
/*
53945403
* call-seq:
5395-
* d.tuesday? -> bool
5404+
* tuesday? -> true or false
53965405
*
5397-
* Returns true if the date is Tuesday.
5406+
* Returns +true+ if +self+ is a Tuesday, +false+ otherwise.
53985407
*/
53995408
static VALUE
54005409
d_lite_tuesday_p(VALUE self)
@@ -5405,9 +5414,9 @@ d_lite_tuesday_p(VALUE self)
54055414

54065415
/*
54075416
* call-seq:
5408-
* d.wednesday? -> bool
5417+
* wednesday? -> true or false
54095418
*
5410-
* Returns true if the date is Wednesday.
5419+
* Returns +true+ if +self+ is a Wednesday, +false+ otherwise.
54115420
*/
54125421
static VALUE
54135422
d_lite_wednesday_p(VALUE self)
@@ -5418,9 +5427,9 @@ d_lite_wednesday_p(VALUE self)
54185427

54195428
/*
54205429
* call-seq:
5421-
* d.thursday? -> bool
5430+
* thursday? -> true or false
54225431
*
5423-
* Returns true if the date is Thursday.
5432+
* Returns +true+ if +self+ is a Thursday, +false+ otherwise.
54245433
*/
54255434
static VALUE
54265435
d_lite_thursday_p(VALUE self)
@@ -5431,9 +5440,9 @@ d_lite_thursday_p(VALUE self)
54315440

54325441
/*
54335442
* call-seq:
5434-
* d.friday? -> bool
5443+
* friday? -> true or false
54355444
*
5436-
* Returns true if the date is Friday.
5445+
* Returns +true+ if +self+ is a Friday, +false+ otherwise.
54375446
*/
54385447
static VALUE
54395448
d_lite_friday_p(VALUE self)
@@ -5444,9 +5453,9 @@ d_lite_friday_p(VALUE self)
54445453

54455454
/*
54465455
* call-seq:
5447-
* d.saturday? -> bool
5456+
* saturday? -> true or false
54485457
*
5449-
* Returns true if the date is Saturday.
5458+
* Returns +true+ if +self+ is a Saturday, +false+ otherwise.
54505459
*/
54515460
static VALUE
54525461
d_lite_saturday_p(VALUE self)
@@ -5477,11 +5486,12 @@ d_lite_nth_kday_p(VALUE self, VALUE n, VALUE k)
54775486

54785487
/*
54795488
* call-seq:
5480-
* d.hour -> fixnum
5489+
* hour -> integer
5490+
*
5491+
* Returns the hour in range (0..23):
54815492
*
5482-
* Returns the hour (0-23).
5493+
* DateTime.new(2001, 2, 3, 4, 5, 6).hour # => 4
54835494
*
5484-
* DateTime.new(2001,2,3,4,5,6).hour #=> 4
54855495
*/
54865496
static VALUE
54875497
d_lite_hour(VALUE self)
@@ -5492,12 +5502,13 @@ d_lite_hour(VALUE self)
54925502

54935503
/*
54945504
* call-seq:
5495-
* d.min -> fixnum
5496-
* d.minute -> fixnum
5505+
* min -> integer
54975506
*
5498-
* Returns the minute (0-59).
5507+
* Returns the minute in range (0..59):
54995508
*
5500-
* DateTime.new(2001,2,3,4,5,6).min #=> 5
5509+
* DateTime.new(2001, 2, 3, 4, 5, 6).min # => 5
5510+
*
5511+
* Date#minute is an alias for Date#min.
55015512
*/
55025513
static VALUE
55035514
d_lite_min(VALUE self)
@@ -5508,12 +5519,13 @@ d_lite_min(VALUE self)
55085519

55095520
/*
55105521
* call-seq:
5511-
* d.sec -> fixnum
5512-
* d.second -> fixnum
5522+
* sec -> integer
5523+
*
5524+
* Returns the second in range (0..59):
55135525
*
5514-
* Returns the second (0-59).
5526+
* DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6
55155527
*
5516-
* DateTime.new(2001,2,3,4,5,6).sec #=> 6
5528+
* Date#second is an alias for Date#sec.
55175529
*/
55185530
static VALUE
55195531
d_lite_sec(VALUE self)
@@ -5524,12 +5536,14 @@ d_lite_sec(VALUE self)
55245536

55255537
/*
55265538
* call-seq:
5527-
* d.sec_fraction -> rational
5528-
* d.second_fraction -> rational
5539+
* sec_fraction -> rational
5540+
*
5541+
* Returns the fractional part of the second in range
5542+
* (Rational(0, 1)...Rational(1, 1)):
55295543
*
5530-
* Returns the fractional part of the second.
5544+
* DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2)
55315545
*
5532-
* DateTime.new(2001,2,3,4,5,6.5).sec_fraction #=> (1/2)
5546+
* Date.second_fraction is an alias for Date#sec_fraction.
55335547
*/
55345548
static VALUE
55355549
d_lite_sec_fraction(VALUE self)

0 commit comments

Comments
 (0)