Module: Doodle::ModMarshal

Included in:
BaseMethods
Defined in:
lib/doodle/marshal.rb

Instance Method Summary collapse

Instance Method Details

#marshal_dumpObject

helper for Marshal.dump



4
5
6
7
# File 'lib/doodle/marshal.rb', line 4

def marshal_dump
  # note: perhaps should also dump singleton attribute definitions?
  instance_variables.map{|x| [x, instance_variable_get(x)] }
end

#marshal_load(data) ⇒ Object

helper for Marshal.load



9
10
11
12
13
# File 'lib/doodle/marshal.rb', line 9

def marshal_load(data)
  data.each do |name, value|
    instance_variable_set(name, value)
  end
end