Module: PgConn
- Defined in:
- lib/pg_conn.rb,
lib/pg_conn/version.rb,
lib/pg_conn/role_methods.rb,
lib/pg_conn/rdbms_methods.rb,
lib/pg_conn/schema_methods.rb,
lib/pg_conn/session_methods.rb
Defined Under Namespace
Classes: Connection, Error, PsqlError, RdbmsMethods, RoleMethods, Rollback, SchemaMethods, SessionMethods
Constant Summary collapse
- VERSION =
"0.23.0"
Class Method Summary collapse
-
.===(element) ⇒ Object
Make the PgConn module pretend it has PgConn instances.
-
.ensure(*args) ⇒ Object
Returns a PgConn::Connection object (aka. a PgConn object).
-
.new(*args, &block) ⇒ Object
Return a PgConn::Connection object.
- .sql_idents(values) ⇒ Object
- .sql_values(values) ⇒ Object
Class Method Details
.===(element) ⇒ Object
Make the PgConn module pretend it has PgConn instances
20 |
# File 'lib/pg_conn.rb', line 20 def self.===(element) element.is_a?(PgConn::Connection) or super end |
.ensure(*args) ⇒ Object
Returns a PgConn::Connection object (aka. a PgConn object). It’s arguments can be an existing connection that will just be returned or a set of PgConn::Connection#initialize arguments that will be used to create a new PgConn::Connection object
26 27 28 29 30 31 32 |
# File 'lib/pg_conn.rb', line 26 def self.ensure(*args) if args.size == 1 && args.first.is_a?(PgConn::Connection) args.first else PgConn::Connection.new(*args) end end |
.new(*args, &block) ⇒ Object
Return a PgConn::Connection object. TODO: A block argument
17 |
# File 'lib/pg_conn.rb', line 17 def self.new(*args, &block) Connection.new(*args, &block) end |
.sql_idents(values) ⇒ Object
990 |
# File 'lib/pg_conn.rb', line 990 def self.sql_idents(values) '"' + values.join('", "') + '"' end |
.sql_values(values) ⇒ Object
989 |
# File 'lib/pg_conn.rb', line 989 def self.sql_values(values) "'" + values.join("', '") + "'" end |