class Postmodern::DB::Adapter

Attributes

config[R]

Public Class Methods

new(config) click to toggle source
# File lib/postmodern/db/adapter.rb, line 9
def initialize(config)
  @config = config
end

Public Instance Methods

execute(sql) click to toggle source
# File lib/postmodern/db/adapter.rb, line 17
def execute(sql)
  pg_adapter.exec(sql)
end
pg_adapter() click to toggle source
# File lib/postmodern/db/adapter.rb, line 13
def pg_adapter
  @pg_adapter ||= PG.connect(db_configuration)
end

Private Instance Methods

db_configuration() click to toggle source
# File lib/postmodern/db/adapter.rb, line 23
def db_configuration
  db_configuration = {}.merge(config)
  db_configuration.delete(:password) unless config[:password]
  db_configuration
end