Class: ActiveHouse::Configuration

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/active_house/configuration.rb

Constant Summary collapse

MAIN_NAME =
:main
CONNECTION_KEYS =
[
    :url, :urls, :host, :port, :scheme, :database
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connection_configObject

Returns the value of attribute connection_config.



19
20
21
# File 'lib/active_house/configuration.rb', line 19

def connection_config
  @connection_config
end

#loggerObject

Returns the value of attribute logger.



19
20
21
# File 'lib/active_house/configuration.rb', line 19

def logger
  @logger
end

Instance Method Details

#connection_config_for(name = nil) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/active_house/configuration.rb', line 30

def connection_config_for(name = nil)
  name ||= MAIN_NAME
  name = name.to_sym
  config = if name == MAIN_NAME
             connection_config.key?(name) ? connection_config.fetch(name) : connection_config
           else
             connection_config.fetch(name)
           end
  config.slice(*CONNECTION_KEYS)
end