Class: OpenAssets::Cache::SQLiteBase

Inherits:
Object
  • Object
show all
Defined in:
lib/openassets/cache/sqlite_base.rb

Overview

The base class of SQLite3 cache implementation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ SQLiteBase

Initializes the connection to the database, and creates the table if needed. @param path The path to the database file. Use ‘:memory:’ for an in-memory database.



13
14
15
16
# File 'lib/openassets/cache/sqlite_base.rb', line 13

def initialize(path)
  @db = SQLite3::Database.new path
  setup
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



9
10
11
# File 'lib/openassets/cache/sqlite_base.rb', line 9

def db
  @db
end

Instance Method Details

#setupObject

Setup table ddl, implements by subclass.

Raises:

  • (StandardError)


19
20
21
# File 'lib/openassets/cache/sqlite_base.rb', line 19

def setup
  raise StandardError.new('need setup method implementation.')
end