summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-09 00:14:22 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-09-09 00:14:22 +0000
commit8dc6147e3efcea20343dc845fc9acfd0bf497812 (patch)
treed2f9c434c7592cd1bba539cbef36c94d0cac8d77
parent507a5116c6aa164577a8b3c471489c9bd6bd62aa (diff)
* lib/date/format.rb (_strptime): now also attaches an element
which denotes leftover substring if exists. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--lib/date/format.rb9
2 files changed, 12 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index f362e85893..8924732859 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Sep 9 08:57:27 2007 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * lib/date/format.rb (_strptime): now also attaches an element
+ which denotes leftover substring if exists.
+
Sun Sep 9 01:59:08 2007 Tanaka Akira <akr@fsij.org>
* marshal.c (r_object0): check T_STRUCT type for structs.
diff --git a/lib/date/format.rb b/lib/date/format.rb
index 3274b9cc85..47cb9cae19 100644
--- a/lib/date/format.rb
+++ b/lib/date/format.rb
@@ -1,5 +1,5 @@
# format.rb: Written by Tadayoshi Funaba 1999-2007
-# $Id: format.rb,v 2.39 2007-09-08 08:30:25+09 tadf Exp $
+# $Id: format.rb,v 2.40 2007-09-09 08:28:03+09 tadf Exp $
require 'rational'
@@ -570,8 +570,9 @@ class Date
private_class_method :_strptime_i
def self._strptime(str, fmt='%F')
+ str = str.dup
e = Format::Bag.new
- return unless _strptime_i(str.dup, fmt, e)
+ return unless _strptime_i(str, fmt, e)
if e._cent
if e.cwyear
@@ -589,6 +590,10 @@ class Date
end
end
+ unless str.empty?
+ e.leftover = str
+ end
+
e.to_hash
end