Class: Persisto::Pg

Inherits:
AbstractAdaptor show all
Defined in:
lib/persisto/adaptors/pg.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database) ⇒ Pg

Returns a new instance of Pg.



12
13
14
# File 'lib/persisto/adaptors/pg.rb', line 12

def initialize database
	@database = database
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



10
11
12
# File 'lib/persisto/adaptors/pg.rb', line 10

def database
  @database
end

Class Method Details

.connect(*args) ⇒ Object



6
7
8
# File 'lib/persisto/adaptors/pg.rb', line 6

def self.connect *args
	new Sequel.connect(*args)
end

Instance Method Details

#delete(qo) ⇒ Object



28
29
30
# File 'lib/persisto/adaptors/pg.rb', line 28

def delete qo
	single_value(qo)
end

#insert(qo) ⇒ Object



20
21
22
# File 'lib/persisto/adaptors/pg.rb', line 20

def insert qo
	single_value(qo)
end

#select(qo) ⇒ Object



16
17
18
# File 'lib/persisto/adaptors/pg.rb', line 16

def select qo
	all(qo)
end

#transaction(&block) ⇒ Object



32
33
34
# File 'lib/persisto/adaptors/pg.rb', line 32

def transaction &block
	database.transaction &block
end

#update(qo) ⇒ Object



24
25
26
# File 'lib/persisto/adaptors/pg.rb', line 24

def update qo
	single_value(qo)
end