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
- #clear(options = nil) ⇒ Object
- #delete(key, options = nil) ⇒ Object
- #key?(key, options = nil) ⇒ Boolean
- #read(key, options = nil) ⇒ Object
- #write(key, attributes, options = nil) ⇒ Object
Instance Method Details
#clear(options = nil) ⇒ Object
27 28 29 30 |
# File 'lib/adapter/sqlite3.rb', line 27 def clear( = 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, = nil) do_setup @delete.execute!(key) end |
#key?(key, options = nil) ⇒ Boolean
6 7 8 |
# File 'lib/adapter/sqlite3.rb', line 6 def key?(key, = 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, = 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, = nil) do_setup @replace.execute!(key, attributes) attributes end |