|
# File rbot/dbhash.rb, line 37
def initialize(bot, key, absfilename=false)
@bot = bot
@key = key
if absfilename && File.exist?(key)
# db already exists, use it
@db = DBHash.open_db(key)
elsif File.exist?(@bot.botclass + "/#{key}.db")
# db already exists, use it
@db = DBHash.open_db(@bot.botclass + "/#{key}.db")
elsif absfilename
# create empty db
@db = DBHash.create_db(key)
else
# create empty db
@db = DBHash.create_db(@bot.botclass + "/#{key}.db")
end
end
|