Permalink
Browse files

Merge pull request #80 from kreynolds/master

Fix scalar_scanner to understand strings starting with an underscore and containing only digits
  • Loading branch information...
tenderlove committed Sep 7, 2012
2 parents 2bced7c + 7e7a7df commit 06c8c7f7de84cb5a29df01d05149f92f99ea967b
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 06c8c7f

Please sign in to comment.