Skip to content

Commit

Permalink
* lib/yaml.rb (YAML::YAML): adjust Marshal version.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Dec 20, 2003
1 parent 43920ad commit d4e661b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 5 additions & 1 deletion ChangeLog
@@ -1,3 +1,7 @@
Sat Dec 20 11:40:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>

* lib/yaml.rb (YAML::YAML): adjust Marshal version.

Sat Dec 20 02:41:02 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>

* lib/webrick/cgi.rb: add file. (yet another CGI library)
Expand All @@ -14,7 +18,7 @@ Sat Dec 20 02:18:31 2003 Yukihiro Matsumoto <matz@ruby-lang.org>

Fri Dec 19 21:24:22 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>

* lib/webrick/httprequest.rb (meta_vers): should not set
* lib/webrick/httprequest.rb (meta_vers): should not set
HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH.

* lib/webrick/https.rb (HTTPRequest#parse): should check presence
Expand Down
8 changes: 4 additions & 4 deletions lib/yaml.rb
@@ -1,4 +1,4 @@
# vim:sw=4:ts=4
# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
# $Id$
#
# YAML.rb
Expand Down Expand Up @@ -152,15 +152,15 @@ def YAML.read_type_class( type, obj_class )
def YAML.object_maker( obj_class, val, is_attr = false )
if Hash === val
name = obj_class.name
ostr = sprintf( "\004\006o:%c%s\000", name.length + 5, 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( /^[^{]+\{/, '' )
p ostr
end
o = ::Marshal.load( ostr )
unless is_attr
val.each_pair { |k,v|
o.instance_eval "@#{k} = v"
o.instance_variable_set("@#{k}", v)
}
end
o
Expand Down
7 changes: 4 additions & 3 deletions lib/yaml/rubytypes.rb
@@ -1,3 +1,4 @@
# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
require 'date'
#
# Type conversions
Expand All @@ -23,7 +24,7 @@ def to_yaml( opts = {} )
YAML::quick_emit( self.object_id, opts ) { |out|
out.map( self.to_yaml_type ) { |map|
to_yaml_properties.each { |m|
map.add( m[1..-1], instance_eval( m ) )
map.add( m[1..-1], instance_variable_get( m ) )
}
}
}
Expand Down Expand Up @@ -253,7 +254,7 @@ def to_yaml( opts = {} )
out.map( self.to_yaml_type ) { |map|
map.add( 'message', self.message )
to_yaml_properties.each { |m|
map.add( m[1..-1], instance_eval( m ) )
map.add( m[1..-1], instance_variable_get( m ) )
}
}
}
Expand All @@ -264,7 +265,7 @@ def to_yaml( opts = {} )
type, obj_class = YAML.read_type_class( type, Exception )
o = YAML.object_maker( obj_class, { 'mesg' => val.delete( 'message' ) }, true )
val.each_pair { |k,v|
o.instance_eval "@#{k} = v"
o.instance_variable_set("@#{k}", v)
}
o
}
Expand Down

0 comments on commit d4e661b

Please sign in to comment.