Permalink
Browse files

Fix scalar_scanner to understand strings starting with an underscore …

…and containing only digits
  • Loading branch information...
1 parent 2bced7c commit 7e7a7dfe1c720973d7a41754d21b5074e12c46e6 @kreynolds kreynolds committed Sep 7, 2012
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/psych/scalar_scanner.rb
  2. +4 −0 test/psych/test_scalar_scanner.rb
@@ -24,7 +24,7 @@ def tokenize string
return string if @string_cache.key?(string)
case string
- when /^[A-Za-z~]/
+ when /^[A-Za-z_~]/
if string.length > 5
@string_cache[string] = true
return string
@@ -87,5 +87,9 @@ def test_scan_float
def test_scan_true
assert_equal true, ss.tokenize('true')
end
+
+ def test_scan_strings_starting_with_underscores
+ assert_equal "_100", ss.tokenize('_100')
+ end
end
end

0 comments on commit 7e7a7df

Please sign in to comment.