mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/delegate.rb (marshal_dump/load): dump & load instance variables by default [ruby-core:24211]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cc58ec90b8
commit
ab2a02348b
2 changed files with 12 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Dec 24 12:08:00 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/delegate.rb (marshal_dump/load): dump & load instance variables
|
||||
by default [ruby-core:24211]
|
||||
|
||||
Thu Dec 24 10:31:50 2009 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||
|
||||
* lib/object.c (rb_obj_cmp): Default <=> operator returns 0 if
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue