summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/scalar_scanner.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/psych/lib/psych/scalar_scanner.rb')
-rw-r--r--ext/psych/lib/psych/scalar_scanner.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/ext/psych/lib/psych/scalar_scanner.rb b/ext/psych/lib/psych/scalar_scanner.rb
index 3e8acbb21c..e390cbb16a 100644
--- a/ext/psych/lib/psych/scalar_scanner.rb
+++ b/ext/psych/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