Module: Gamefic::Plot::Snapshot

Included in:
Gamefic::Plot
Defined in:
lib/gamefic/plot/snapshot.rb

Instance Method Summary collapse

Instance Method Details

#restore(snapshot) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/gamefic/plot/snapshot.rb', line 10

def restore snapshot
  snapshot = JSON.parse(snapshot, symbolize_names: false) if snapshot.is_a?(String)
  # HACK: Force conclusion of current subplots

  subplots.each { |s| s.conclude }
  subplots.clear
  Gamefic::Plot::Darkroom.new(self).restore(snapshot)
  entities.each { |e| e.flush }
end

#saveHash

Returns:



6
7
8
# File 'lib/gamefic/plot/snapshot.rb', line 6

def save
  Gamefic::Plot::Darkroom.new(self).save
end