From c474911e5b78749c5a85db39256240db5fb9e3be Mon Sep 17 00:00:00 2001 From: why Date: Sat, 15 May 2004 03:11:28 +0000 Subject: * lib/yaml.rb: removed fallback to pure Ruby parser. * lib/yaml/baseemitter.rb (node_text): rewriting folded scalars. * ext/syck/syck.h: reports style of scalars now, be they plain, block single-, or double-quoted. * ext/syck/syck.c: ditto. * ext/syck/gram.c: ditto. * ext/syck/node.c: ditto. * ext/syck/token.c: ditto. * ext/syck/rubyext.c (yaml_org_handler): symbols loaded only if scalar style is plain. * test/yaml/test_yaml.rb (test_perl_regexp): updated test to match new regexp serialization. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/yaml/rubytypes.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/yaml/rubytypes.rb') diff --git a/lib/yaml/rubytypes.rb b/lib/yaml/rubytypes.rb index adebf9439e..1f7f49633c 100644 --- a/lib/yaml/rubytypes.rb +++ b/lib/yaml/rubytypes.rb @@ -290,7 +290,7 @@ class String ( self.count( "^ -~", "^\r\n" ) / self.size > 0.3 || self.count( "\x00" ) > 0 ) end def to_yaml_type - "!ruby/string#{ if self.class != ::String; ":#{ self.class }"; end }" + "!ruby/string#{ ":#{ self.class }" if self.class != ::String }" end def to_yaml_fold nil @@ -315,8 +315,8 @@ class String } elsif self.is_binary_data? out.binary_base64( self ) - elsif self =~ /^ |#{YAML::ESCAPE_CHAR}| $/ - complex = false + # elsif self =~ /^ |#{YAML::ESCAPE_CHAR}| $/ + # complex = false else out.node_text( self, to_yaml_fold ) end @@ -326,7 +326,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 )}\"" -- cgit v1.2.3