Class: Postmodern::DB::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/postmodern/db/adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Adapter

Returns a new instance of Adapter.



9
10
11
# File 'lib/postmodern/db/adapter.rb', line 9

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/postmodern/db/adapter.rb', line 7

def config
  @config
end

Instance Method Details

#execute(sql) ⇒ Object



17
18
19
# File 'lib/postmodern/db/adapter.rb', line 17

def execute(sql)
  pg_adapter.exec(sql)
end

#pg_adapterObject



13
14
15
# File 'lib/postmodern/db/adapter.rb', line 13

def pg_adapter
  @pg_adapter ||= PG.connect(db_configuration)
end