Class: DbAgile::Core::Connection
- Inherits:
-
Object
- Object
- DbAgile::Core::Connection
- Defined in:
- lib/dbagile/core/connection.rb
Instance Attribute Summary collapse
-
#chain ⇒ Object
readonly
Returns the value of attribute chain.
Instance Method Summary collapse
-
#initialize(chain) ⇒ Connection
constructor
Creates a database instance with an underlying adapter.
-
#inspect ⇒ Object
Delegated to the chain.
-
#plug(*args) ⇒ Object
Hot plug.
-
#transaction(&block) ⇒ Object
Executes the block inside a transaction.
Constructor Details
#initialize(chain) ⇒ Connection
Creates a database instance with an underlying adapter
10 11 12 |
# File 'lib/dbagile/core/connection.rb', line 10 def initialize(chain) @chain = chain end |
Instance Attribute Details
#chain ⇒ Object (readonly)
Returns the value of attribute chain.
5 6 7 |
# File 'lib/dbagile/core/connection.rb', line 5 def chain @chain end |
Instance Method Details
#inspect ⇒ Object
Delegated to the chain
22 23 24 |
# File 'lib/dbagile/core/connection.rb', line 22 def inspect @chain.inspect end |
#plug(*args) ⇒ Object
Hot plug
17 18 19 |
# File 'lib/dbagile/core/connection.rb', line 17 def plug(*args) @chain.plug(*args) end |
#transaction(&block) ⇒ Object
Executes the block inside a transaction.
44 45 46 47 |
# File 'lib/dbagile/core/connection.rb', line 44 def transaction(&block) raise ArgumentError, "Missing transaction block" unless block Transaction.new(self).execute(&block) end |