Class: Travis::Config::Heroku::Database

Inherits:
Struct
  • Object
show all
Includes:
Travis::Config::Helpers
Defined in:
lib/travis/config/heroku/database.rb

Constant Summary collapse

VARIABLES =
{ application_name: ENV['DYNO'] || $0, statement_timeout: 10_000 }
DEFAULTS =
{ adapter: 'postgresql', encoding: 'unicode', variables: VARIABLES }

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Travis::Config::Helpers

#blank?, #camelize, #compact, #deep_merge, #deep_symbolize_keys

Instance Attribute Details

#options=(value) ⇒ Object

Sets the attribute options

Parameters:

  • value (Object)

    the value to set the attribute options to.

Returns:

  • (Object)

    the newly set value



6
7
8
# File 'lib/travis/config/heroku/database.rb', line 6

def options=(value)
  @options = value
end

Instance Method Details

#configObject



12
13
14
15
16
17
18
# File 'lib/travis/config/heroku/database.rb', line 12

def config
  config = compact(Url.parse(url).to_h)
  config = deep_merge(DEFAULTS, config) unless config.empty?
  config[:pool] = pool.to_i if pool
  config[:prepared_statements] = prepared_statements != 'false' if prepared_statements
  config
end