Class: Reins::Database
- Inherits:
-
Object
- Object
- Reins::Database
- Defined in:
- lib/reins/database.rb
Constant Summary collapse
- DEFAULT_PATH =
"test.db".freeze
Class Attribute Summary collapse
Class Method Summary collapse
Class Attribute Details
.path ⇒ Object
10 11 12 |
# File 'lib/reins/database.rb', line 10 def path @path ||= DEFAULT_PATH end |
Class Method Details
.connection ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/reins/database.rb', line 14 def connection @connection ||= begin db = SQLite3::Database.new(path) db.results_as_hash = true db end end |
.reset! ⇒ Object
22 23 24 25 26 |
# File 'lib/reins/database.rb', line 22 def reset! @connection&.close @connection = nil @path = nil end |