diff --git a/ChangeLog b/ChangeLog index 1d49d477c4..8d763c6c6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Dec 16 03:17:29 2003 why the lucky stiff + + * lib/yaml/rubytypes.rb: comments in strings. [ruby-talk:88012] + + * test/yaml/test_yaml.rb: add test. + Tue Dec 16 01:14:44 2003 Nobuyoshi Nakada * eval.c (catch_timer): check rb_thread_crtical in main native diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index f718df9b9f..a29c4fda8b 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -304,7 +304,7 @@ class String self elsif empty? "''" - elsif self =~ /^[^#{YAML::WORD_CHAR}]|#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}]( |$)| $|\n|\'/ + elsif self =~ /^[^#{YAML::WORD_CHAR}]| \#|#{YAML::ESCAPE_CHAR}|[#{YAML::SPACE_INDICATORS}]( |$)| $|\n|\'/ "\"#{YAML.escape( self )}\"" elsif YAML.detect_implicit( self ) != 'str' "\"#{YAML.escape( self )}\"" diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb index ded9530d80..6ddde2065c 100644 --- a/test/yaml/test_yaml.rb +++ b/test/yaml/test_yaml.rb @@ -189,6 +189,13 @@ EOY ) end + def test_ambiguous_comments + # [ruby-talk:88012] + assert_to_yaml( "Call the method #dave", <