diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-17 11:54:07 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-08-17 11:54:07 -0700 |
commit | 95fc90723bb041134c8fe3be8714e8599664ce8b (patch) | |
tree | b4aa5370693ae8c689a38f1ea6700a17a3c555c5 /lib | |
parent | b4c0f7f54d9652e73e77a8703da5d031f70041ea (diff) | |
download | psych-95fc90723bb041134c8fe3be8714e8599664ce8b.zip |
syncing with ruby trunk
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych/core_ext.rb | 1 | ||||
-rw-r--r-- | lib/psych/scalar_scanner.rb | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/psych/core_ext.rb b/lib/psych/core_ext.rb index be26b2f..2ad75e1 100644 --- a/lib/psych/core_ext.rb +++ b/lib/psych/core_ext.rb @@ -36,4 +36,5 @@ module Kernel end remove_method :y rescue nil alias y psych_y + private :y end diff --git a/lib/psych/scalar_scanner.rb b/lib/psych/scalar_scanner.rb index 29d66ee..b92d3c0 100644 --- a/lib/psych/scalar_scanner.rb +++ b/lib/psych/scalar_scanner.rb @@ -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 |