Class: BlueprintConfig::Backend::Base
- Inherits:
-
Object
- Object
- BlueprintConfig::Backend::Base
show all
- Defined in:
- lib/blueprint_config/backend/base.rb
Instance Method Summary
collapse
Instance Method Details
#fresh? ⇒ Boolean
29
30
31
|
# File 'lib/blueprint_config/backend/base.rb', line 29
def fresh?
true
end
|
#nest_hash(hash, delimiter = '_') ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/blueprint_config/backend/base.rb', line 8
def nest_hash(hash, delimiter = '_')
hash.each_with_object({}) do |(key, value), results|
steps = key.split(delimiter).reverse
nested = steps.reduce(value) { |value, key| { key.to_sym => value } }
results.deep_merge!(nested) do |_key, a, b|
if a.is_a?(Hash) && b.is_a?(String)
a.deep_merge(nil => b)
elsif b.is_a?(Hash) && a.is_a?(String)
b.deep_merge(nil => a)
else
b
end
end
end
end
|
#source ⇒ Object
25
26
27
|
# File 'lib/blueprint_config/backend/base.rb', line 25
def source
self.class.name
end
|