ruby-changes:1929
From: ko1@a...
Date: 9 Sep 2007 09:16:05 +0900
Subject: [ruby-changes:1929] tadf - Ruby:r13420 (ruby_1_8): * lib/date/format.rb (_strptime): now also attaches an element
tadf 2007-09-09 09:15:57 +0900 (Sun, 09 Sep 2007) New Revision: 13420 Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/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/branches/ruby_1_8/ChangeLog?r1=13420&r2=13419 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/lib/date/format.rb?r1=13420&r2=13419 Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 13419) +++ ruby_1_8/ChangeLog (revision 13420) @@ -1,3 +1,8 @@ +Sun Sep 9 09:14:45 2007 Tadayoshi Funaba <tadf@d...> + + * lib/date/format.rb (_strptime): now also attaches an element + which denotes leftover substring if exists. + Sat Sep 8 10:22:20 2007 Yukihiro Matsumoto <matz@r...> * struct.c (rb_struct_s_members): should raise TypeError instead Index: ruby_1_8/lib/date/format.rb =================================================================== --- ruby_1_8/lib/date/format.rb (revision 13419) +++ ruby_1_8/lib/date/format.rb (revision 13420) @@ -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' @@ -598,8 +598,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 @@ -617,6 +618,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