Class: PGTrunk::Adapters::Postgres
- Inherits:
-
Object
- Object
- PGTrunk::Adapters::Postgres
- Defined in:
- lib/pg_trunk/core/adapters/postgres.rb
Overview
Creates an instance of the PGTrunk Postgres adapter. This is the only supported adapter for PGTrunk.
Defined Under Namespace
Classes: Connection
Instance Method Summary collapse
- #dumper ⇒ Object
-
#execute_operation(operation) ⇒ Object
Execute operation by its definition.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, **opts, &block) ⇒ Object (private)
73 74 75 76 77 |
# File 'lib/pg_trunk/core/adapters/postgres.rb', line 73 def method_missing(symbol, *args, **opts, &block) super unless connection.respond_to?(symbol, true) connection.send(symbol, *args, **opts, &block) end |
Instance Method Details
#dumper ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/pg_trunk/core/adapters/postgres.rb', line 53 def dumper # This instance is used to dump the table # using its name extracted from the database. # That's why we can skip prefix/suffix definitions # in the parameters of the constructor. @dumper ||= connection.create_schema_dumper({}) end |
#execute_operation(operation) ⇒ Object
Execute operation by its definition
48 49 50 51 |
# File 'lib/pg_trunk/core/adapters/postgres.rb', line 48 def execute_operation(operation) query = operation.to_sql(server_version) connection.execute(query) if query end |