Skip to content

Commit 00bb7f6

Browse files
[DOC] Enhanced RDoc (#62)
Minor edits to 11 methods' documentation.
1 parent 48f9180 commit 00bb7f6

File tree

1 file changed

+57
-33
lines changed

1 file changed

+57
-33
lines changed

ext/date/date_core.c

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5543,7 +5543,7 @@ d_lite_sec(VALUE self)
55435543
*
55445544
* DateTime.new(2001, 2, 3, 4, 5, 6.5).sec_fraction # => (1/2)
55455545
*
5546-
* Date.second_fraction is an alias for Date#sec_fraction.
5546+
* Date#second_fraction is an alias for Date#sec_fraction.
55475547
*/
55485548
static VALUE
55495549
d_lite_sec_fraction(VALUE self)
@@ -5584,12 +5584,14 @@ d_lite_zone(VALUE self)
55845584

55855585
/*
55865586
* call-seq:
5587-
* d.julian? -> bool
5587+
* d.julian? -> true or false
55885588
*
5589-
* Returns true if the date is before the day of calendar reform.
5589+
* Returns +true+ if the date is before the date of calendar reform,
5590+
* +false+ otherwise:
5591+
*
5592+
* (Date.new(1582, 10, 15) - 1).julian? # => true
5593+
* Date.new(1582, 10, 15).julian? # => false
55905594
*
5591-
* Date.new(1582,10,15).julian? #=> false
5592-
* (Date.new(1582,10,15) - 1).julian? #=> true
55935595
*/
55945596
static VALUE
55955597
d_lite_julian_p(VALUE self)
@@ -5600,12 +5602,14 @@ d_lite_julian_p(VALUE self)
56005602

56015603
/*
56025604
* call-seq:
5603-
* d.gregorian? -> bool
5605+
* gregorian? -> true or false
56045606
*
5605-
* Returns true if the date is on or after the day of calendar reform.
5607+
* Returns +true+ if the date is on or after
5608+
* the date of calendar reform, +false+ otherwise:
5609+
*
5610+
* Date.new(1582, 10, 15).gregorian? # => true
5611+
* (Date.new(1582, 10, 15) - 1).gregorian? # => false
56065612
*
5607-
* Date.new(1582,10,15).gregorian? #=> true
5608-
* (Date.new(1582,10,15) - 1).gregorian? #=> false
56095613
*/
56105614
static VALUE
56115615
d_lite_gregorian_p(VALUE self)
@@ -5616,12 +5620,13 @@ d_lite_gregorian_p(VALUE self)
56165620

56175621
/*
56185622
* call-seq:
5619-
* d.leap? -> bool
5623+
* leap? -> true or false
5624+
*
5625+
* Returns +true+ if the year is a leap year, +false+ otherwise:
56205626
*
5621-
* Returns true if the year is a leap year.
5627+
* Date.new(2000).leap? # => true
5628+
* Date.new(2001).leap? # => false
56225629
*
5623-
* Date.new(2000).leap? #=> true
5624-
* Date.new(2001).leap? #=> false
56255630
*/
56265631
static VALUE
56275632
d_lite_leap_p(VALUE self)
@@ -5640,12 +5645,25 @@ d_lite_leap_p(VALUE self)
56405645

56415646
/*
56425647
* call-seq:
5643-
* d.start -> float
5648+
* start -> float
5649+
*
5650+
* Returns the Julian start date for calendar reform;
5651+
* if not an infinity, the returned value is suitable
5652+
* for passing to Date#jd:
5653+
*
5654+
* d = Date.new(2001, 2, 3, Date::ITALY)
5655+
* s = d.start # => 2299161.0
5656+
* Date.jd(s).to_s # => "1582-10-15"
5657+
*
5658+
* d = Date.new(2001, 2, 3, Date::ENGLAND)
5659+
* s = d.start # => 2361222.0
5660+
* Date.jd(s).to_s # => "1752-09-14"
56445661
*
5645-
* Returns the Julian day number denoting the day of calendar reform.
5662+
* Date.new(2001, 2, 3, Date::GREGORIAN).start # => -Infinity
5663+
* Date.new(2001, 2, 3, Date::JULIAN).start # => Infinity
5664+
*
5665+
* See argument {start}[rdoc-ref:Date@Argument+start].
56465666
*
5647-
* Date.new(2001,2,3).start #=> 2299161.0
5648-
* Date.new(2001,2,3,Date::GREGORIAN).start #=> -Infinity
56495667
*/
56505668
static VALUE
56515669
d_lite_start(VALUE self)
@@ -5710,12 +5728,17 @@ dup_obj_with_new_start(VALUE obj, double sg)
57105728

57115729
/*
57125730
* call-seq:
5713-
* d.new_start([start=Date::ITALY]) -> date
5731+
* new_start(start = Date::ITALY]) -> new_date
5732+
*
5733+
* Returns a copy of +self+ with the given +start+ value:
57145734
*
5715-
* Duplicates self and resets its day of calendar reform.
5735+
* d0 = Date.new(2000, 2, 3)
5736+
* d0.julian? # => false
5737+
* d1 = d0.new_start(Date::JULIAN)
5738+
* d1.julian? # => true
5739+
*
5740+
* See argument {start}[rdoc-ref:Date@Argument+start].
57165741
*
5717-
* d = Date.new(1582,10,15)
5718-
* d.new_start(Date::JULIAN) #=> #<Date: 1582-10-05 ...>
57195742
*/
57205743
static VALUE
57215744
d_lite_new_start(int argc, VALUE *argv, VALUE self)
@@ -5734,9 +5757,10 @@ d_lite_new_start(int argc, VALUE *argv, VALUE self)
57345757

57355758
/*
57365759
* call-seq:
5737-
* d.italy -> date
5760+
* italy -> new_date
5761+
*
5762+
* Equivalent to Date#new_start with argument Date::ITALY.
57385763
*
5739-
* This method is equivalent to new_start(Date::ITALY).
57405764
*/
57415765
static VALUE
57425766
d_lite_italy(VALUE self)
@@ -5746,9 +5770,9 @@ d_lite_italy(VALUE self)
57465770

57475771
/*
57485772
* call-seq:
5749-
* d.england -> date
5773+
* england -> new_date
57505774
*
5751-
* This method is equivalent to new_start(Date::ENGLAND).
5775+
* Equivalent to Date#new_start with argument Date::ENGLAND.
57525776
*/
57535777
static VALUE
57545778
d_lite_england(VALUE self)
@@ -5758,9 +5782,9 @@ d_lite_england(VALUE self)
57585782

57595783
/*
57605784
* call-seq:
5761-
* d.julian -> date
5785+
* julian -> new_date
57625786
*
5763-
* This method is equivalent to new_start(Date::JULIAN).
5787+
* Equivalent to Date#new_start with argument Date::JULIAN.
57645788
*/
57655789
static VALUE
57665790
d_lite_julian(VALUE self)
@@ -5770,9 +5794,9 @@ d_lite_julian(VALUE self)
57705794

57715795
/*
57725796
* call-seq:
5773-
* d.gregorian -> date
5797+
* gregorian -> new_date
57745798
*
5775-
* This method is equivalent to new_start(Date::GREGORIAN).
5799+
* Equivalent to Date#new_start with argument Date::GREGORIAN.
57765800
*/
57775801
static VALUE
57785802
d_lite_gregorian(VALUE self)
@@ -6253,9 +6277,9 @@ d_lite_minus(VALUE self, VALUE other)
62536277

62546278
/*
62556279
* call-seq:
6256-
* d.next_day([n=1]) -> date
6280+
* next_day(n = 1) -> new_date
62576281
*
6258-
* This method is equivalent to d + n.
6282+
* Equivalent to Date#+ with argument +n+.
62596283
*/
62606284
static VALUE
62616285
d_lite_next_day(int argc, VALUE *argv, VALUE self)
@@ -6270,9 +6294,9 @@ d_lite_next_day(int argc, VALUE *argv, VALUE self)
62706294

62716295
/*
62726296
* call-seq:
6273-
* d.prev_day([n=1]) -> date
6297+
* prev_day(n = 1) -> new_date
62746298
*
6275-
* This method is equivalent to d - n.
6299+
* Equivalent to Date#- with argument +n+.
62766300
*/
62776301
static VALUE
62786302
d_lite_prev_day(int argc, VALUE *argv, VALUE self)

0 commit comments

Comments
 (0)