Method: Cuboid::Snapshot.load

Defined in:
lib/cuboid/snapshot.rb

.load(snapshot) ⇒ Snapshot

Returns self.

Parameters:

  • snapshot (String)

    Location of the snapshot to load.

Returns:

Raises:



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/cuboid/snapshot.rb', line 99

def load( snapshot )
    directory = get_temporary_directory

    @location = snapshot
     = ( snapshot )

    extract( snapshot, directory )

    Data.load( "#{directory}/data/" )
    State.load( "#{directory}/state/" )

    self
ensure

    # Don't delete the directory immediately because there are disk DBs that
    # use those files.
    Kernel.at_exit do
        FileUtils.rm_rf( directory )
    end
end