Skip to content

Commit

Permalink
Merge pull request #80 from kreynolds/master
Browse files Browse the repository at this point in the history
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 06c8c7f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/psych/scalar_scanner.rb
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/psych/test_scalar_scanner.rb
Expand Up @@ -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.