diff options
-rw-r--r-- | lib/psych/scalar_scanner.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/psych/scalar_scanner.rb b/lib/psych/scalar_scanner.rb index 3e8acbb..e390cbb 100644 --- a/lib/psych/scalar_scanner.rb +++ b/lib/psych/scalar_scanner.rb @@ -74,13 +74,19 @@ module Psych end i when FLOAT - return Float(string.gsub(/[,_]/, '')) rescue ArgumentError + begin + return Float(string.gsub(/[,_]/, '')) + rescue ArgumentError + end @string_cache[string] = true string else if string.count('.') < 2 - return Integer(string.gsub(/[,_]/, '')) rescue ArgumentError + begin + return Integer(string.gsub(/[,_]/, '')) + rescue ArgumentError + end end @string_cache[string] = true |