Class: Purview::Connections::Base
- Defined in:
- lib/purview/connections/base.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #disconnect ⇒ Object
- #execute(sql) ⇒ Object
-
#initialize(opts) ⇒ Base
constructor
A new instance of Base.
- #with_transaction ⇒ Object
Constructor Details
#initialize(opts) ⇒ Base
8 9 10 |
# File 'lib/purview/connections/base.rb', line 8 def initialize(opts) @raw_connection = raw_connection_type.connect(opts) end |
Class Method Details
.connect(opts) ⇒ Object
4 5 6 |
# File 'lib/purview/connections/base.rb', line 4 def self.connect(opts) new(opts) end |
Instance Method Details
#disconnect ⇒ Object
12 13 14 15 16 |
# File 'lib/purview/connections/base.rb', line 12 def disconnect raw_connection.disconnect @raw_connection = nil self end |
#execute(sql) ⇒ Object
18 19 20 |
# File 'lib/purview/connections/base.rb', line 18 def execute(sql) raw_connection.execute(sql) end |
#with_transaction ⇒ Object
22 23 24 |
# File 'lib/purview/connections/base.rb', line 22 def with_transaction raw_connection.with_transaction { yield } end |