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.rb | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) (limited to 'lib/yaml.rb') diff --git a/lib/yaml.rb b/lib/yaml.rb index baa599d3c5..96fc64f48b 100644 --- a/lib/yaml.rb +++ b/lib/yaml.rb @@ -5,21 +5,12 @@ # # Loads the parser/loader and emitter/writer. # - module YAML - begin - require 'yaml/syck' - @@parser = YAML::Syck::Parser - @@loader = YAML::Syck::DefaultLoader - @@emitter = YAML::Syck::Emitter - rescue LoadError - require 'yaml/parser' - @@parser = YAML::Parser - @@loader = YAML::DefaultLoader - require 'yaml/emitter' - @@emitter = YAML::Emitter - end + require 'yaml/syck' + @@parser = YAML::Syck::Parser + @@loader = YAML::Syck::DefaultLoader + @@emitter = YAML::Syck::Emitter require 'yaml/loader' require 'yaml/stream' @@ -148,7 +139,7 @@ module YAML end # - # Method to extract colon-separated type and class, returning + # Method to extract colon-seperated type and class, returning # the type and the constant of the class # def YAML.read_type_class( type, obj_class ) @@ -160,20 +151,12 @@ module YAML # # Allocate blank object # - def YAML.object_maker( obj_class, val, is_attr = false ) + def YAML.object_maker( obj_class, val ) if Hash === val - # name = obj_class.name - # ostr = sprintf( "%c%co:%c%s\000", ::Marshal::MAJOR_VERSION, ::Marshal::MINOR_VERSION, - # name.length + 5, name ) - # if is_attr - # ostr[ -1, 1 ] = ::Marshal.dump( val ).sub( /^[^{]+\{/, '' ) - # end o = obj_class.allocate - unless is_attr - val.each_pair { |k,v| - o.instance_variable_set("@#{k}", v) - } - end + val.each_pair { |k,v| + o.instance_variable_set("@#{k}", v) + } o else raise YAML::Error, "Invalid object explicitly tagged !ruby/Object: " + val.inspect -- cgit v1.2.3