diff options
Diffstat (limited to 'lib/time.rb')
-rw-r--r-- | lib/time.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/time.rb b/lib/time.rb index bd20a1a8e9..b565130b50 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -25,6 +25,9 @@ require 'date' # :startdoc: class Time + + VERSION = "0.3.0" + class << Time # @@ -388,6 +391,8 @@ class Time # heuristic to detect the format of the input string, you provide # a second argument that describes the format of the string. # + # Raises `ArgumentError` if the date or format is invalid. + # # If a block is given, the year described in +date+ is converted by the # block. For example: # @@ -452,7 +457,7 @@ class Time # def strptime(date, format, now=self.now) d = Date._strptime(date, format) - raise ArgumentError, "invalid date or strptime format - `#{date}' `#{format}'" unless d + raise ArgumentError, "invalid date or strptime format - '#{date}' '#{format}'" unless d if seconds = d[:seconds] if sec_fraction = d[:sec_fraction] usec = sec_fraction * 1000000 @@ -509,8 +514,8 @@ class Time (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s+ (\d{2,})\s+ (\d{2})\s* - :\s*(\d{2})\s* - (?::\s*(\d{2}))?\s+ + :\s*(\d{2}) + (?:\s*:\s*(\d\d))?\s+ ([+-]\d{4}| UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Z])/ix =~ date # Since RFC 2822 permit comments, the regexp has no right anchor. @@ -701,7 +706,7 @@ class Time # # If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise. # - # +fractional_digits+ specifies a number of digits to use for fractional + # +fraction_digits+ specifies a number of digits to use for fractional # seconds. Its default value is 0. # # require 'time' |