Skip to content
Jesse Lingeman edited this page Mar 6, 2013 · 2 revisions

Purpose

Function for saving an Datavyu database to a file. The filename must be a full path to where you want to save. See example below for a good way to do this.

Note for advanced users:

Additionally, it is important to note that saveDB will save only what is in the global Ruby variable $db. If another database has been loaded such that multiples exist, the database to save must be put into $db before calling saveDB.

Parameters

Filename (String)

The filename/path of where we want to save the file.

Returns

Nothing.

Examples

# We first have to create a string that points to the directory we want to store
# the file in.

# Save the file to the Desktop in a file called test.opf. The tilde (~) is a shortcut
# for the current users' home directory. ~/Desktop is the current users' Desktop.
# File.expand_path is what will expand that tilde into a full path, so it is necessary.

filename = File.expand_path("~/Desktop/test.opf")

# Save the database
saveDB(filename)