* ext/psych/lib/psych/scalar_scanner.rb: Only consider strings

with fewer than 2 dots to be numbers. [ruby-core:38915]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2011-08-13 00:00:26 +00:00
parent e8b3d0decf
commit b5f05971f5
2 changed files with 10 additions and 2 deletions

View File

@ -1,3 +1,8 @@
Sat Aug 13 08:55:38 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/scalar_scanner.rb: Only consider strings
with fewer than 2 dots to be numbers. [ruby-core:38915]
Sat Aug 13 08:47:20 2011 Tadayoshi Funaba <tadf@dotrb.org>
* ext/date/date_core.c: [ruby-core:38855].

View File

@ -68,8 +68,11 @@ module Psych
end
i
else
return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError
return Float(string.gsub(/[,_]/, '')) rescue ArgumentError
if string.count('.') < 2
return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError
return Float(string.gsub(/[,_]/, '')) rescue ArgumentError
end
@string_cache[string] = true
string
end