ultra_config 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ultra_config/config.rb +4 -2
- data/lib/ultra_config/namespace.rb +5 -3
- data/lib/ultra_config/validation.rb +2 -1
- data/ultra_config.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e94fa14e6cc352acbdb58f0374be625261e5dedb
|
4
|
+
data.tar.gz: 904585f13c8d3adabb5829bc9cfb96549d7437b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b452a720488ea9a584f8ec2d9ab1a30f816922ebbd69e9839e8c4d73956eccdf5f245bbfa028237b2835cb4dcb155f9bdcd5bde1a75ac7372994fa121763cbd7
|
7
|
+
data.tar.gz: 7d8f5fbda7d94f90899377d5b577ae24a86d368a2afd9ac80de7c18af7826876a0567a1be5e4659ff334a46d031a4d957b306a9a58d13ed59e1934d1d6dbf44a
|
data/lib/ultra_config/config.rb
CHANGED
@@ -7,7 +7,9 @@ module UltraConfig
|
|
7
7
|
|
8
8
|
attr_reader :value
|
9
9
|
|
10
|
-
def initialize(options = {}, &block)
|
10
|
+
def initialize(name, parents, options = {}, &block)
|
11
|
+
@name = name
|
12
|
+
@parents = parents
|
11
13
|
@config_block = block
|
12
14
|
|
13
15
|
@value = options[:default].nil? ? nil : options[:default]
|
@@ -21,7 +23,7 @@ module UltraConfig
|
|
21
23
|
type_safety(Settings.type_safety) unless @type_safety_checked
|
22
24
|
@value = @intermediate_value
|
23
25
|
rescue UltraConfig::Validation::ValidationError
|
24
|
-
raise UltraConfig::Validation::ValidationError.new(@error_msg, sanitize? ? '*****' : @intermediate_value)
|
26
|
+
raise UltraConfig::Validation::ValidationError.new(@error_msg, @parents + [@name], sanitize? ? '*****' : @intermediate_value)
|
25
27
|
ensure
|
26
28
|
@type_safety_checked = false
|
27
29
|
@intermediate_value = nil
|
@@ -6,8 +6,10 @@ module UltraConfig
|
|
6
6
|
|
7
7
|
attr_reader :objects
|
8
8
|
|
9
|
-
def initialize(&block)
|
9
|
+
def initialize(parents = [], &block)
|
10
10
|
@configuration = [block]
|
11
|
+
@parents = parents
|
12
|
+
|
11
13
|
reset
|
12
14
|
end
|
13
15
|
|
@@ -21,12 +23,12 @@ module UltraConfig
|
|
21
23
|
end
|
22
24
|
|
23
25
|
def namespace(name, &block)
|
24
|
-
@objects[name] = Namespace.new(&block)
|
26
|
+
@objects[name] = Namespace.new(@parents + [name], &block)
|
25
27
|
define_singleton_method(name) { @objects[name] }
|
26
28
|
end
|
27
29
|
|
28
30
|
def config(name, options = {}, &block)
|
29
|
-
@objects[name] = Config.new(options, &block)
|
31
|
+
@objects[name] = Config.new(name, @parents, options, &block)
|
30
32
|
define_singleton_method("#{name}=") { |value| @objects[name].value = value }
|
31
33
|
define_singleton_method(name) { @objects[name].value }
|
32
34
|
end
|
data/ultra_config.gemspec
CHANGED