ruby-changes:20908
From: tenderlove <ko1@a...>
Date: Sat, 13 Aug 2011 09:00:35 +0900 (JST)
Subject: [ruby-changes:20908] tenderlove:r32957 (trunk): * ext/psych/lib/psych/scalar_scanner.rb: Only consider strings
tenderlove 2011-08-13 09:00:26 +0900 (Sat, 13 Aug 2011) New Revision: 32957 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=32957 Log: * ext/psych/lib/psych/scalar_scanner.rb: Only consider strings with fewer than 2 dots to be numbers. [ruby-core:38915] Modified files: trunk/ChangeLog trunk/ext/psych/lib/psych/scalar_scanner.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 32956) +++ ChangeLog (revision 32957) @@ -1,3 +1,8 @@ +Sat Aug 13 08:55:38 2011 Aaron Patterson <aaron@t...> + + * 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@d...> * ext/date/date_core.c: [ruby-core:38855]. Index: ext/psych/lib/psych/scalar_scanner.rb =================================================================== --- ext/psych/lib/psych/scalar_scanner.rb (revision 32956) +++ ext/psych/lib/psych/scalar_scanner.rb (revision 32957) @@ -68,8 +68,11 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/