From 9780fc27d941d6975fb29e96584add5383f0316c Mon Sep 17 00:00:00 2001 From: why Date: Thu, 22 May 2003 06:14:17 +0000 Subject: * ext/syck/rubyext.c (rb_syck_err_handler): raise ArgumentError on malformed YAML. * lib/yaml/rubytypes.rb: String#to_yaml was missing space indicators at the end of a line. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/yaml/rubytypes.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/yaml/rubytypes.rb') diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index ae5585db5d..a670237635 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -1,4 +1,5 @@ require 'date' +require 'yaml/constants' # # Type conversions # @@ -273,7 +274,7 @@ class String "''" elsif YAML.detect_implicit( self ) != 'str' "\"#{YAML.escape( self )}\"" - elsif self =~ /#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}] |\n|\'/ + elsif self =~ /#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}]( |\n|$)|\'/ "\"#{YAML.escape( self )}\"" elsif self =~ /^[^#{YAML::WORD_CHAR}]/ "\"#{YAML.escape( self )}\"" -- cgit v1.2.3