Class: OpenAssets::Cache::SQLiteBase
- Inherits:
-
Object
- Object
- OpenAssets::Cache::SQLiteBase
- Defined in:
- lib/openassets/cache/sqlite_base.rb
Overview
The base class of SQLite3 cache implementation.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
Instance Method Summary collapse
-
#initialize(path) ⇒ SQLiteBase
constructor
Initializes the connection to the database, and creates the table if needed.
-
#setup ⇒ Object
Setup table ddl, implements by subclass.
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
#db ⇒ Object (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
#setup ⇒ Object
Setup table ddl, implements by subclass.
19 20 21 |
# File 'lib/openassets/cache/sqlite_base.rb', line 19 def setup raise StandardError.new('need setup method implementation.') end |