Class: NexposeSCCM::DataSource::Helpers::PGHelper::Connection
- Inherits:
-
Object
- Object
- NexposeSCCM::DataSource::Helpers::PGHelper::Connection
- Defined in:
- lib/nexpose_sccm/helpers/pg_helper.rb
Instance Method Summary collapse
- #get_data(query) ⇒ Object
-
#initialize(settings) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(settings) ⇒ Connection
Returns a new instance of Connection.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/nexpose_sccm/helpers/pg_helper.rb', line 8 def initialize(settings) host = settings[:host] port = settings[:port] user = settings[:user] pass = settings[:pass] db = settings[:db] sslmode = settings[:sslmode] @conn = PG::Connection.open(:host => host, :dbname => db, :port => port, :user => user, :password => pass, :sslmode => sslmode) end |
Instance Method Details
#get_data(query) ⇒ Object
19 20 21 |
# File 'lib/nexpose_sccm/helpers/pg_helper.rb', line 19 def get_data(query) @conn.exec(query) end |