module Shackles::ConnectionSpecification
Public Class Methods
new(config, adapter_method)
click to toggle source
Calls superclass method
# File lib/shackles/connection_specification.rb, line 35 def initialize(config, adapter_method) super(config.deep_symbolize_keys, adapter_method) end
Public Instance Methods
config()
click to toggle source
# File lib/shackles/connection_specification.rb, line 49 def config @current_config = nil if Shackles.environment != @current_config_environment || Shackles.global_config_sequence != @current_config_sequence return @current_config if @current_config @current_config_environment = Shackles.environment @current_config_sequence = Shackles.global_config_sequence config = @config.dup if @config.has_key?(Shackles.environment) env_config = @config[Shackles.environment] # an array of databases for this environment; for now, just choose the first non-nil element if env_config.is_a?(Array) env_config = env_config.detect { |individual_config| !individual_config.nil? } end config.merge!(env_config.symbolize_keys) end config.keys.each do |key| next unless config[key].is_a?(String) config[key] = config[key] % config end config.merge!(Shackles.global_config) @current_config = CacheCoherentHash.new(self) @current_config.replace(config) @current_config end
config=(value)
click to toggle source
# File lib/shackles/connection_specification.rb, line 78 def config=(value) @config = value @current_config = nil end
initialize_dup(original)
click to toggle source
Calls superclass method
# File lib/shackles/connection_specification.rb, line 44 def initialize_dup(original) @current_config = nil super end