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



57
58
59
60
61
# File 'lib/wee/state.rb', line 57

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

#take_snapshotObject



49
50
51
52
53
54
55
# File 'lib/wee/state.rb', line 49

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