* ext/psych/lib/psych/scalar_scanner.rb: Fix scalar_scanner to

understand strings starting with an underscore and containing only
  digits.  Thanks Kelley Reynolds.

* test/psych/test_scalar_scanner.rb: test for fix

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2012-10-22 21:06:25 +00:00
Родитель 1c5ae4b31d
Коммит c05952c6a1
3 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Tue Oct 23 06:04:07 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/scalar_scanner.rb: Fix scalar_scanner to
understand strings starting with an underscore and containing only
digits. Thanks Kelley Reynolds.
* test/psych/test_scalar_scanner.rb: test for fix
Tue Oct 23 06:00:41 2012 Aaron Patterson <aaron@tenderlovemaking.com> Tue Oct 23 06:00:41 2012 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych.rb: Changed comment in psych.rb to update new * ext/psych/lib/psych.rb: Changed comment in psych.rb to update new

Просмотреть файл

@ -24,7 +24,7 @@ module Psych
return string if @string_cache.key?(string) return string if @string_cache.key?(string)
case string case string
when /^[A-Za-z~]/ when /^[A-Za-z_~]/
if string.length > 5 if string.length > 5
@string_cache[string] = true @string_cache[string] = true
return string return string

Просмотреть файл

@ -87,5 +87,9 @@ module Psych
def test_scan_true def test_scan_true
assert_equal true, ss.tokenize('true') assert_equal true, ss.tokenize('true')
end end
def test_scan_strings_starting_with_underscores
assert_equal "_100", ss.tokenize('_100')
end
end end
end end