Class: Kaal::Persistence::Database
- Inherits:
-
Object
- Object
- Kaal::Persistence::Database
- Defined in:
- lib/kaal/persistence/database.rb
Overview
Thin wrapper around a Sequel connection to keep table access consistent.
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #definitions_dataset ⇒ Object
- #delayed_jobs_dataset ⇒ Object
- #dispatches_dataset ⇒ Object
-
#initialize(connection) ⇒ Database
constructor
A new instance of Database.
- #locks_dataset ⇒ Object
Constructor Details
#initialize(connection) ⇒ Database
Returns a new instance of Database.
13 14 15 16 17 18 19 20 |
# File 'lib/kaal/persistence/database.rb', line 13 def initialize(connection) Kaal::Sequel.require_sequel! @connection = if connection.is_a?(::Sequel::Database) connection else ::Sequel.connect(connection) end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
11 12 13 |
# File 'lib/kaal/persistence/database.rb', line 11 def connection @connection end |
Instance Method Details
#definitions_dataset ⇒ Object
22 23 24 |
# File 'lib/kaal/persistence/database.rb', line 22 def definitions_dataset connection[:kaal_definitions] end |
#delayed_jobs_dataset ⇒ Object
34 35 36 |
# File 'lib/kaal/persistence/database.rb', line 34 def delayed_jobs_dataset connection[:kaal_delayed_jobs] end |
#dispatches_dataset ⇒ Object
26 27 28 |
# File 'lib/kaal/persistence/database.rb', line 26 def dispatches_dataset connection[:kaal_dispatches] end |
#locks_dataset ⇒ Object
30 31 32 |
# File 'lib/kaal/persistence/database.rb', line 30 def locks_dataset connection[:kaal_locks] end |