Module: DB2Query
- Extended by:
- ActiveSupport::Autoload
- Defined in:
- lib/db2_query.rb,
lib/db2_query/base.rb,
lib/db2_query/core.rb,
lib/db2_query/config.rb,
lib/db2_query/result.rb,
lib/db2_query/railtie.rb,
lib/db2_query/version.rb,
lib/db2_query/formatter.rb,
lib/db2_query/odbc_connector.rb,
lib/db2_query/connection_handling.rb,
lib/db2_query/database_statements.rb
Defined Under Namespace
Modules: ConnectionHandling, Core, DatabaseStatements, Formatter
Classes: AbstractFormatter, Base, ConnStringConnector, DsnConnector, ODBCConnector, Railtie, Result
Constant Summary
collapse
- VERSION =
"0.2.1"
- CONNECTION_TYPES =
i[dsn conn_string].freeze
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
5
6
7
|
# File 'lib/db2_query/config.rb', line 5
def config
@config ||= read_config
end
|
.config_file ⇒ Object
17
18
19
|
# File 'lib/db2_query/config.rb', line 17
def config_file
Pathname.new(config_path)
end
|
.config_path ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/db2_query/config.rb', line 9
def config_path
if defined?(Rails)
"#{Rails.root}/config/db2query_database.yml"
else
ENV["DQ_CONFIG_PATH"]
end
end
|
.connection_env ⇒ Object
26
27
28
|
# File 'lib/db2_query/config.rb', line 26
def connection_env
ENV["RAILS_ENV"].to_sym
end
|
.read_config ⇒ Object
21
22
23
24
|
# File 'lib/db2_query/config.rb', line 21
def read_config
erb = ERB.new(config_file.read)
YAML.parse(erb.result(binding)).transform
end
|