class Storage

Attributes

database[RW]
file[RW]

Public Class Methods

new(file=File.join(File.expand_path('../..', __FILE__), 'storage.yml')) click to toggle source
# File lib/trakr/storage.rb, line 3
def initialize(file=File.join(File.expand_path('../..', __FILE__), 'storage.yml'))
    @file = file
end

Public Instance Methods

load() click to toggle source
# File lib/trakr/storage.rb, line 7
def load
     @database = YAML.load_file(@file)
     if not @database
         @database = {}
     end
end
write!() click to toggle source
# File lib/trakr/storage.rb, line 14
def write!
    File.open(@file,'w+') {|f| f.write(@database.to_yaml)}
end