Module: Wee::ObjectSnapshotMixin

Included in:
Object
Defined in:
lib/wee/state.rb

Overview

module DupReplaceSnapshotMixin

Instance Method Summary collapse

Instance Method Details

#restore_snapshot(snap) ⇒ Object



74
75
76
77
78
# File 'lib/wee/state.rb', line 74

def restore_snapshot(snap)
  snap.each do |k,v|
    instance_variable_set(k, v)
  end
end

#take_snapshotObject



66
67
68
69
70
71
72
# File 'lib/wee/state.rb', line 66

def take_snapshot
  snap = Hash.new
  instance_variables.each do |iv|
    snap[iv] = instance_variable_get(iv)
  end
  snap
end