Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* ext/psych/lib/psych/scalar_scanner.rb: make sure strings that look

  like base 60 numbers are serialized as quoted strings.
* test/psych/test_string.rb: test for change.

Fixes #25
  • Loading branch information...
commit 8dd7448b183456a1dff5ce30dc3e3d49c78bd813 1 parent 7f812e9
@tenderlove authored
View
6 CHANGELOG.rdoc
@@ -1,3 +1,9 @@
+Mon Nov 7 20:31:52 2011 Aaron Patterson <aaron@tenderlovemaking.com>
+
+ * ext/psych/lib/psych/scalar_scanner.rb: make sure strings that look
+ like base 60 numbers are serialized as quoted strings.
+ * test/psych/test_string.rb: test for change.
+
Wed Oct 5 02:50:27 2011 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/syntax_error.rb: Add file, line, offset, and
View
2  lib/psych/scalar_scanner.rb
@@ -61,7 +61,7 @@ def tokenize string
else
string.sub(/^:/, '').to_sym
end
- when /^[-+]?[1-9][0-9_]*(:[0-5]?[0-9])+$/
+ when /^[-+]?[0-9][0-9_]*(:[0-5]?[0-9])+$/
i = 0
string.split(':').each_with_index do |n,e|
i += (n.to_i * 60 ** (e - 2).abs)
View
6 test/psych/test_string.rb
@@ -2,6 +2,12 @@
module Psych
class TestString < TestCase
+ def test_string_with_base_60
+ yaml = Psych.dump '01:03:05'
+ assert_match "'01:03:05'", yaml
+ assert_equal '01:03:05', Psych.load(yaml)
+ end
+
def test_tagged_binary_should_be_dumped_as_binary
string = "hello world!"
string.force_encoding 'ascii-8bit'
Please sign in to comment.
Something went wrong with that request. Please try again.