From 8a805839458696b052a448b7635ce14d829a4470 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Thu, 7 Jul 2022 15:21:57 -0500 Subject: [PATCH 1/6] Enhanced RDoc --- ext/date/date_core.c | 128 ++++++++++++++++++++++++------------------- 1 file changed, 71 insertions(+), 57 deletions(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index e71eec2..1ca51e2 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -4515,7 +4515,7 @@ date_s__parse(int argc, VALUE *argv, VALUE klass) * 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 @@ -5186,12 +5186,15 @@ d_lite_mjd(VALUE self) /* * call-seq: - * d.ld -> integer + * ld -> integer * - * Returns the Lilian day number. This is a whole number, which is - * adjusted by the offset as the local time. + * Returns the + * {Lilian day number}[https://en.wikipedia.org/wiki/Lilian_date], + * which is the number of days since the beginning of the Gregorian + * calendar, October 15, 1582. + * + * Date.new(2001,2,3).ld # => 152784 * - * Date.new(2001,2,3).ld #=> 152784 */ static VALUE d_lite_ld(VALUE self) @@ -5202,12 +5205,13 @@ d_lite_ld(VALUE self) /* * call-seq: - * d.year -> integer + * year -> integer + * + * Returns the year: * - * Returns the year. + * Date.new(2001,2,3).year # => 2001 + * (Date.new(1,1,1) - 1).year # => 0 * - * Date.new(2001,2,3).year #=> 2001 - * (Date.new(1,1,1) - 1).year #=> 0 */ static VALUE d_lite_year(VALUE self) @@ -5218,11 +5222,12 @@ d_lite_year(VALUE self) /* * call-seq: - * d.yday -> fixnum + * yday -> integer * - * Returns the day of the year (1-366). + * Returns the day of the year, in range (1..366): + * + * Date.new(2001,2,3).yday # => 34 * - * Date.new(2001,2,3).yday #=> 34 */ static VALUE d_lite_yday(VALUE self) @@ -5233,12 +5238,13 @@ d_lite_yday(VALUE self) /* * call-seq: - * d.mon -> fixnum - * d.month -> fixnum + * mon -> integer + * + * Returns the month in range (1..12): * - * Returns the month (1-12). + * Date.new(2001,2,3).mon # => 2 * - * Date.new(2001,2,3).mon #=> 2 + * Date#month is an alias for Date#mon. */ static VALUE d_lite_mon(VALUE self) @@ -5249,12 +5255,13 @@ d_lite_mon(VALUE self) /* * call-seq: - * d.mday -> fixnum - * d.day -> fixnum + * mday -> integer * - * Returns the day of the month (1-31). + * Returns the day of the month in range (1..31): * - * Date.new(2001,2,3).mday #=> 3 + * Date.new(2001,2,3).mday # => 3 + * + * Date#day is an alias for Date#mday. */ static VALUE d_lite_mday(VALUE self) @@ -5265,11 +5272,12 @@ d_lite_mday(VALUE self) /* * call-seq: - * d.day_fraction -> rational + * day_fraction -> rational + * + * Returns the fractional part of the day in range (Rational(0, 1)...Rational(1, 1)): * - * Returns the fractional part of the day. + * DateTime.new(2001,2,3,12).day_fraction # => (1/2) * - * DateTime.new(2001,2,3,12).day_fraction #=> (1/2) */ static VALUE d_lite_day_fraction(VALUE self) @@ -5351,11 +5359,12 @@ d_lite_wnum1(VALUE self) /* * call-seq: - * d.wday -> fixnum + * wday -> integer * - * Returns the day of week (0-6, Sunday is zero). + * Returns the day of week in range (0..6); Sunday is 0: + * + * Date.new(2001,2,3).wday # => 6 * - * Date.new(2001,2,3).wday #=> 6 */ static VALUE d_lite_wday(VALUE self) @@ -5366,9 +5375,9 @@ d_lite_wday(VALUE self) /* * call-seq: - * d.sunday? -> bool + * sunday? -> true or false * - * Returns true if the date is Sunday. + * Returns +true+ if +self+ is a Sunday, +false+ otherwise. */ static VALUE d_lite_sunday_p(VALUE self) @@ -5377,11 +5386,11 @@ d_lite_sunday_p(VALUE self) return f_boolcast(m_wday(dat) == 0); } -/* +/ * call-seq: - * d.monday? -> bool + * monday? -> true or false * - * Returns true if the date is Monday. + * Returns +true+ if +self+ is a Monday, +false+ otherwise. */ static VALUE d_lite_monday_p(VALUE self) @@ -5392,9 +5401,9 @@ d_lite_monday_p(VALUE self) /* * call-seq: - * d.tuesday? -> bool + * tuesday? -> true or false * - * Returns true if the date is Tuesday. + * Returns +true+ if +self+ is a Tuesday, +false+ otherwise. */ static VALUE d_lite_tuesday_p(VALUE self) @@ -5405,9 +5414,9 @@ d_lite_tuesday_p(VALUE self) /* * call-seq: - * d.wednesday? -> bool + * wednesday? -> true or false * - * Returns true if the date is Wednesday. + * Returns +true+ if +self+ is a Wednesday, +false+ otherwise. */ static VALUE d_lite_wednesday_p(VALUE self) @@ -5418,9 +5427,9 @@ d_lite_wednesday_p(VALUE self) /* * call-seq: - * d.thursday? -> bool + * thursday? -> true or false * - * Returns true if the date is Thursday. + * Returns +true+ if +self+ is a Thursday, +false+ otherwise. */ static VALUE d_lite_thursday_p(VALUE self) @@ -5431,9 +5440,9 @@ d_lite_thursday_p(VALUE self) /* * call-seq: - * d.friday? -> bool + * friday? -> true or false * - * Returns true if the date is Friday. + * Returns +true+ if +self+ is a Friday, +false+ otherwise. */ static VALUE d_lite_friday_p(VALUE self) @@ -5444,9 +5453,9 @@ d_lite_friday_p(VALUE self) /* * call-seq: - * d.saturday? -> bool + * saturday? -> true or false * - * Returns true if the date is Saturday. + * Returns +true+ if +self+ is a Saturday, +false+ otherwise. */ static VALUE d_lite_saturday_p(VALUE self) @@ -5477,11 +5486,12 @@ d_lite_nth_kday_p(VALUE self, VALUE n, VALUE k) /* * call-seq: - * d.hour -> fixnum + * hour -> integer * - * Returns the hour (0-23). + * Returns the hour in range (0..23): + * + * DateTime.new(2001, 2, 3, 4, 5, 6).hour # => 4 * - * DateTime.new(2001,2,3,4,5,6).hour #=> 4 */ static VALUE d_lite_hour(VALUE self) @@ -5492,12 +5502,13 @@ d_lite_hour(VALUE self) /* * call-seq: - * d.min -> fixnum - * d.minute -> fixnum + * min -> integer + * + * Returns the minute in range (0..59):0 * - * Returns the minute (0-59). + * DateTime.new(2001, 2, 3, 4, 5, 6).min # => 5 * - * DateTime.new(2001,2,3,4,5,6).min #=> 5 + * Date#minute is an alias for Date#min. */ static VALUE d_lite_min(VALUE self) @@ -5508,12 +5519,13 @@ d_lite_min(VALUE self) /* * call-seq: - * d.sec -> fixnum - * d.second -> fixnum + * sec -> integer +t * + * Returns the second in range (0..59): * - * Returns the second (0-59). + * DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6 * - * DateTime.new(2001,2,3,4,5,6).sec #=> 6 + * Date#second is an alias for Date#sec. */ static VALUE d_lite_sec(VALUE self) @@ -5524,16 +5536,18 @@ d_lite_sec(VALUE self) /* * call-seq: - * d.sec_fraction -> rational - * d.second_fraction -> rational + * sec_fraction -> rational * - * Returns the fractional part of the second. + * Returns the fractional part of the second in range + * (Rational(0, 1)..Rational(59, 1)): * - * DateTime.new(2001,2,3,4,5,6.5).sec_fraction #=> (1/2) + * DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2) + * + * Date.second_fraction is an alias for Date#sec_fraction. */ static VALUE d_lite_sec_fraction(VALUE self) -{ + get_d1(self); return m_sf_in_sec(dat); } From 8cd56e5ebebd0d72ee253b3cabe19ebf4cc54d15 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Thu, 7 Jul 2022 15:29:24 -0500 Subject: [PATCH 2/6] Enhanced RDoc --- ext/date/date_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 1ca51e2..ff507d9 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -5386,7 +5386,7 @@ d_lite_sunday_p(VALUE self) return f_boolcast(m_wday(dat) == 0); } -/ +/* * call-seq: * monday? -> true or false * From fb207b30e6ef3ba179d48323d9402c1b3d5e1b6c Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Thu, 7 Jul 2022 15:36:55 -0500 Subject: [PATCH 3/6] Enhanced RDoc --- ext/date/date_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index ff507d9..d6a6ac3 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -5520,7 +5520,7 @@ d_lite_min(VALUE self) /* * call-seq: * sec -> integer -t * + * * Returns the second in range (0..59): * * DateTime.new(2001, 2, 3, 4, 5, 6).sec # => 6 From 56a8bc5acca96eda4b4dd6d2c01c062d28e7803f Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Thu, 7 Jul 2022 15:55:49 -0500 Subject: [PATCH 4/6] Enhanced RDoc --- ext/date/date_core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index d6a6ac3..384a43c 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -5193,7 +5193,7 @@ d_lite_mjd(VALUE self) * which is the number of days since the beginning of the Gregorian * calendar, October 15, 1582. * - * Date.new(2001,2,3).ld # => 152784 + * Date.new(2001, 2, 3).ld # => 152784 * */ static VALUE @@ -5209,8 +5209,8 @@ d_lite_ld(VALUE self) * * Returns the year: * - * Date.new(2001,2,3).year # => 2001 - * (Date.new(1,1,1) - 1).year # => 0 + * Date.new(2001, 2, 3).year # => 2001 + * (Date.new(1, 1, 1) - 1).year # => 0 * */ static VALUE @@ -5226,7 +5226,7 @@ d_lite_year(VALUE self) * * Returns the day of the year, in range (1..366): * - * Date.new(2001,2,3).yday # => 34 + * Date.new(2001, 2, 3).yday # => 34 * */ static VALUE @@ -5242,7 +5242,7 @@ d_lite_yday(VALUE self) * * Returns the month in range (1..12): * - * Date.new(2001,2,3).mon # => 2 + * Date.new(2001, 2, 3).mon # => 2 * * Date#month is an alias for Date#mon. */ @@ -5259,7 +5259,7 @@ d_lite_mon(VALUE self) * * Returns the day of the month in range (1..31): * - * Date.new(2001,2,3).mday # => 3 + * Date.new(2001, 2, 3).mday # => 3 * * Date#day is an alias for Date#mday. */ @@ -5363,7 +5363,7 @@ d_lite_wnum1(VALUE self) * * Returns the day of week in range (0..6); Sunday is 0: * - * Date.new(2001,2,3).wday # => 6 + * Date.new(2001, 2, 3).wday # => 6 * */ static VALUE @@ -5547,7 +5547,7 @@ d_lite_sec(VALUE self) */ static VALUE d_lite_sec_fraction(VALUE self) - +{ get_d1(self); return m_sf_in_sec(dat); } From e7a02882c580f84d85580e49404e9cd39c51e0c8 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Thu, 7 Jul 2022 16:00:06 -0500 Subject: [PATCH 5/6] Enhanced RDoc --- ext/date/date_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 384a43c..3a6e85b 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -5504,7 +5504,7 @@ d_lite_hour(VALUE self) * call-seq: * min -> integer * - * Returns the minute in range (0..59):0 + * Returns the minute in range (0..59): * * DateTime.new(2001, 2, 3, 4, 5, 6).min # => 5 * From c39071075def4ef9f7eda9a26da6e94e08014f60 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Fri, 8 Jul 2022 06:28:22 -0500 Subject: [PATCH 6/6] Enhanced RDoc --- ext/date/date_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 3a6e85b..7b71a64 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -5539,7 +5539,7 @@ d_lite_sec(VALUE self) * sec_fraction -> rational * * Returns the fractional part of the second in range - * (Rational(0, 1)..Rational(59, 1)): + * (Rational(0, 1)...Rational(1, 1)): * * DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2) *