Module: Purview::Mixins::Connection

Included in:
Databases::Base, Pullers::BaseSQL
Defined in:
lib/purview/mixins/connection.rb

Instance Method Summary collapse

Instance Method Details

#connectObject



4
5
6
# File 'lib/purview/mixins/connection.rb', line 4

def connect
  connection_type.new(connection_opts)
end

#connection_optsObject



8
9
10
11
12
13
14
15
16
# File 'lib/purview/mixins/connection.rb', line 8

def connection_opts
  {
    :database => database_name,
    :host => database_host,
    :password => database_password,
    :port => database_port,
    :username => database_username,
  }
end

#with_new_connectionObject



18
19
20
# File 'lib/purview/mixins/connection.rb', line 18

def with_new_connection
  connection_type.with_new_connection(connection_opts) { |connection| yield connection }
end