Module: Shackles::ConnectionSpecification
- Defined in:
- lib/shackles/connection_specification.rb
Defined Under Namespace
Classes: CacheCoherentHash
Instance Method Summary
collapse
Instance Method Details
#config ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/shackles/connection_specification.rb', line 38
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]
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) ⇒ Object
67
68
69
70
|
# File 'lib/shackles/connection_specification.rb', line 67
def config=(value)
@config = value
@current_config = nil
end
|
#initialize(config, adapter_method) ⇒ Object
34
35
36
|
# File 'lib/shackles/connection_specification.rb', line 34
def initialize(config, adapter_method)
super(config.deep_symbolize_keys, adapter_method)
end
|