summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-10 17:44:55 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-10 17:44:55 +0000
commitfe26dc97daeda338e4672fcd866b0c50b0267e58 (patch)
treea6080d921a3848dc255792c5152acecc4e6effec
parentd2d01d43409036b5784b8a243b652faa061883ab (diff)
* lib/time.rb: [DOC] Document constants by @markijbema [Fixes GH-377]
https://github.com/ruby/ruby/pull/377 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/time.rb13
2 files changed, 18 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index d45b4d75db9..5efb8c36640 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Aug 11 02:44:03 2013 Zachary Scott <e@zzak.io>
+
+ * lib/time.rb: [DOC] Document constants by @markijbema [Fixes GH-377]
+ https://github.com/ruby/ruby/pull/377
+
Sun Aug 11 01:28:52 2013 Tanaka Akira <akr@fsij.org>
* configure.in: Revert r42458.
diff --git a/lib/time.rb b/lib/time.rb
index 977010087e6..23e8add40a8 100644
--- a/lib/time.rb
+++ b/lib/time.rb
@@ -174,7 +174,9 @@ class Time
end
private :zone_utc?
+ # An array with the number of days per month in a leap year.
LeapYearMonthDays = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
+ # An array with the number of days per month in a regular year.
CommonYearMonthDays = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def month_days(y, m)
if ((y % 4 == 0) && (y % 100 != 0)) || (y % 400 == 0)
@@ -401,6 +403,13 @@ class Time
end
end
+ #
+ # A hash of upcased RFC2822 month-names mapped to number of the month.
+ # For example:
+ #
+ # Time.MonthValue['JAN']
+ # #=> 1
+ #
MonthValue = {
'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6,
'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' =>10, 'NOV' =>11, 'DEC' =>12
@@ -577,9 +586,13 @@ class Time
end
alias rfc822 rfc2822
+
+ # An array of day names, as defined by RFC 2822
RFC2822_DAY_NAME = [
'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'
]
+
+ # An array of month names, as defined by RFC 2822
RFC2822_MONTH_NAME = [
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'