Module: Shackles::ConnectionSpecification
- Defined in:
- lib/shackles/connection_specification.rb
Defined Under Namespace
Classes: CacheCoherentHash
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(klass) ⇒ Object
22
23
24
25
|
# File 'lib/shackles/connection_specification.rb', line 22
def self.included(klass)
klass.send(:remove_method, :config)
klass.alias_method_chain :initialize, :deep_symbolize
end
|
Instance Method Details
#config ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/shackles/connection_specification.rb', line 31
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
60
61
62
63
|
# File 'lib/shackles/connection_specification.rb', line 60
def config=(value)
@config = value
@current_config = nil
end
|
#initialize_with_deep_symbolize(config, adapter_method) ⇒ Object
27
28
29
|
# File 'lib/shackles/connection_specification.rb', line 27
def initialize_with_deep_symbolize(config, adapter_method)
initialize_without_deep_symbolize(config.deep_symbolize_keys, adapter_method)
end
|