Module: Adapter::Sqlite3

Defined in:
lib/adapter/sqlite3.rb,
lib/adapter/sqlite3/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Instance Method Details

#clear(options = nil) ⇒ Object



27
28
29
30
# File 'lib/adapter/sqlite3.rb', line 27

def clear(options = nil)
  do_setup
  @clear.execute!
end

#delete(key, options = nil) ⇒ Object



22
23
24
25
# File 'lib/adapter/sqlite3.rb', line 22

def delete(key, options = nil)
  do_setup
  @delete.execute!(key)
end

#key?(key, options = nil) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/adapter/sqlite3.rb', line 6

def key?(key, options = nil)
  @exists.execute!(key).first.first.to_i == 1
end

#read(key, options = nil) ⇒ Object



10
11
12
13
14
# File 'lib/adapter/sqlite3.rb', line 10

def read(key, options = nil)
  do_setup
  rows = @select.execute!(key)
  rows.empty? ? nil : rows.first.first
end

#write(key, attributes, options = nil) ⇒ Object



16
17
18
19
20
# File 'lib/adapter/sqlite3.rb', line 16

def write(key, attributes, options = nil)
  do_setup
  @replace.execute!(key, attributes)
  attributes
end