[前][次][番号順一覧][スレッド一覧]

ruby-changes:1928

From: ko1@a...
Date: 9 Sep 2007 09:14:33 +0900
Subject: [ruby-changes:1928] tadf - Ruby:r13419 (trunk): * lib/date/format.rb (_strptime): now also attaches an element

tadf	2007-09-09 09:14:22 +0900 (Sun, 09 Sep 2007)

  New Revision: 13419

  Modified files:
    trunk/ChangeLog
    trunk/lib/date/format.rb

  Log:
    * lib/date/format.rb (_strptime): now also attaches an element
      which denotes leftover substring if exists.
    


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/date/format.rb?r1=13419&r2=13418
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13419&r2=13418

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 13418)
+++ ChangeLog	(revision 13419)
@@ -1,3 +1,8 @@
+Sun Sep  9 08:57:27 2007  Tadayoshi Funaba  <tadf@d...>
+
+	* 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@f...>
 
 	* marshal.c (r_object0): check T_STRUCT type for structs.
Index: lib/date/format.rb
===================================================================
--- lib/date/format.rb	(revision 13418)
+++ lib/date/format.rb	(revision 13419)
@@ -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 @@
   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 @@
       end
     end
 
+    unless str.empty?
+      e.leftover = str
+    end
+
     e.to_hash
   end
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]