From 30793b7ca6cccaaac5d87a0f4c4cc152db841ff9 Mon Sep 17 00:00:00 2001 From: marcandre Date: Thu, 24 Dec 2009 03:08:15 +0000 Subject: * lib/delegate.rb (marshal_dump/load): dump & load instance variables by default [ruby-core:24211] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@26163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/delegate.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/delegate.rb b/lib/delegate.rb index 77804e47f..f8a71f186 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -183,10 +183,16 @@ class Delegator # Serialization support for the object returned by \_\_getobj\_\_. def marshal_dump - __getobj__ + [ + instance_variables, + instance_variables.map{|var| instance_variable_get(var)}, + __getobj__ + ] end # Reinitializes delegation from a serialized object. def marshal_load(obj) + vars, values, obj = obj + vars.each_with_index{|var, i| instance_variable_set(var, values[i])} __setobj__(obj) end -- cgit