Class: Litedb::Connection
- Inherits:
-
SQLite3::Database
- Object
- SQLite3::Database
- Litedb::Connection
- Defined in:
- lib/litedb/connection.rb
Constant Summary collapse
- DEFAULT_FILE =
":memory:"
- DEFAULT_OPTIONS =
{ synchronous: :NORMAL, mmap_size: 32 * 1024, # 32 kilobytes journal_size_limit: 64 * 1024 * 1024 # 64 megabytes }.freeze
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(file = nil, options = {}, zvfs = nil) ⇒ Connection
constructor
A new instance of Connection.
- #run_statement(statement, *args) ⇒ Object
Constructor Details
#initialize(file = nil, options = {}, zvfs = nil) ⇒ Connection
Returns a new instance of Connection.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/litedb/connection.rb', line 17 def initialize(file = nil, = {}, zvfs = nil) @scheduler = Litescheduler.instance file ||= DEFAULT_FILE = .transform_keys { |key| begin key.to_sym rescue key end } @config = DEFAULT_OPTIONS.merge() super(file, @config, zvfs) set_pragmas run_migrations prepare_statements end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
15 16 17 |
# File 'lib/litedb/connection.rb', line 15 def config @config end |
Instance Method Details
#run_statement(statement, *args) ⇒ Object
36 37 38 |
# File 'lib/litedb/connection.rb', line 36 def run_statement(statement, *args) statements[statement].execute!(*args) end |