Module: Rutt::DB::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/rutt/db/config.rb

Instance Method Summary collapse

Instance Method Details

#get(key) ⇒ Object



16
17
18
# File 'lib/rutt/db/config.rb', line 16

def get(key)
  $db.get_first_value("select value from config where key = ?", key)
end

#make_table!Object



6
7
8
9
10
11
12
13
14
# File 'lib/rutt/db/config.rb', line 6

def make_table!
  $db.execute(%{
   create table if not exists config (
                id integer PRIMARY KEY,
                key text,
                value text,
                UNIQUE(key))
  })
end

#set(key, value) ⇒ Object



20
21
22
# File 'lib/rutt/db/config.rb', line 20

def set(key, value)
  $db.execute("insert or replace into config(key, value) values (?, ?)", key, value)
end