diff options
Diffstat (limited to 'lib/yaml')
-rw-r--r-- | lib/yaml/rubytypes.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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 )}\"" |