Class: Forty::Database
- Inherits:
-
Object
- Object
- Forty::Database
- Defined in:
- lib/forty/database.rb,
lib/forty/configuration.rb
Instance Attribute Summary collapse
-
#database ⇒ Object
Returns the value of attribute database.
-
#host ⇒ Object
Returns the value of attribute host.
-
#name ⇒ Object
Returns the value of attribute name.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#database ⇒ Object
Returns the value of attribute database.
9 10 11 |
# File 'lib/forty/database.rb', line 9 def database @database end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/forty/database.rb', line 5 def host @host end |
#name ⇒ Object
Returns the value of attribute name.
23 24 25 |
# File 'lib/forty/configuration.rb', line 23 def name @name end |
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/forty/database.rb', line 8 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
6 7 8 |
# File 'lib/forty/database.rb', line 6 def port @port end |
#user ⇒ Object
Returns the value of attribute user.
7 8 9 |
# File 'lib/forty/database.rb', line 7 def user @user end |
Instance Method Details
#execute(statement) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/forty/database.rb', line 11 def execute(statement) @db ||= PG.connect( host: self.host, port: self.port, user: self.user, password: self.password, dbname: self.database ) @db.exec(statement) end |