From 2fa9a0b08c7d2c672d2ae2ac8b76a66cfc1c5082 Mon Sep 17 00:00:00 2001 From: why Date: Thu, 6 May 2004 06:29:56 +0000 Subject: * lib/yaml/rubytypes.rb (to_yaml): added instance variable handling for Ranges, Strings, Structs, Regexps. * lib/yaml/rubytypes.rb (to_yaml_fold): new method for setting a String's flow style. * lib/yaml.rb (YAML::object_maker): now uses Object.allocate. * ext/syck/gram.c: fixed transfer methods on structs, broke it last commit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/yaml.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/yaml.rb') diff --git a/lib/yaml.rb b/lib/yaml.rb index 644538c579..baa599d3c5 100644 --- a/lib/yaml.rb +++ b/lib/yaml.rb @@ -162,13 +162,13 @@ module YAML # def YAML.object_maker( obj_class, val, is_attr = false ) 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 = ::Marshal.load( ostr ) + # 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) -- cgit v1.2.3