mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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/branches/ruby_1_8@13420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
64ec051588
commit
0912d358b3
2 changed files with 12 additions and 2 deletions
|
|
@ -1,3 +1,8 @@
|
|||
Sun Sep 9 09:14:45 2007 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* struct.c (rb_struct_s_members): should raise TypeError instead
|
||||
|
|
|
|||
|
|
@ -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 @@ 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
|
||||
|
|
@ -617,6 +618,10 @@ class Date
|
|||
end
|
||||
end
|
||||
|
||||
unless str.empty?
|
||||
e.leftover = str
|
||||
end
|
||||
|
||||
e.to_hash
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue