document String#to_time exception

This commit is contained in:
Vipul A M 2013-05-02 09:49:40 +05:30
parent 2cf86936b7
commit 796ed59e20
1 changed files with 1 additions and 0 deletions

View File

@ -15,6 +15,7 @@ class String
# "2012-12-13 06:12".to_time # => 2012-12-13 06:12:00 +0100
# "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100
# "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 05:12:00 UTC
# "12/13/2012".to_time # => ArgumentError: argument out of range
def to_time(form = :local)
parts = Date._parse(self, false)
return if parts.empty?