ultra_config 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58a62bd2b4590fb7d00e698c1bd3514773eb7de8
4
- data.tar.gz: 10fbaa211096cc69a4ee95a40ecf01ed5d2536e5
3
+ metadata.gz: e94fa14e6cc352acbdb58f0374be625261e5dedb
4
+ data.tar.gz: 904585f13c8d3adabb5829bc9cfb96549d7437b7
5
5
  SHA512:
6
- metadata.gz: 164325f002a4eead14d033410e0aacdd72c6eb8e962c9de84d8c4999e0ff22b6009cfbbec91e4a05c1bf2d163ebe653979fda80b5c644a788ba77518b61ecfa2
7
- data.tar.gz: 7b53809a1b08a2cee51941080eae2b879f0ae0c953417db076f631c74ceab49e9556720eebe05117ca541e4150e7293664a4c5053adc803b2fef45d33e016e9b
6
+ metadata.gz: b452a720488ea9a584f8ec2d9ab1a30f816922ebbd69e9839e8c4d73956eccdf5f245bbfa028237b2835cb4dcb155f9bdcd5bde1a75ac7372994fa121763cbd7
7
+ data.tar.gz: 7d8f5fbda7d94f90899377d5b577ae24a86d368a2afd9ac80de7c18af7826876a0567a1be5e4659ff334a46d031a4d957b306a9a58d13ed59e1934d1d6dbf44a
@@ -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
@@ -8,8 +8,9 @@ module UltraConfig
8
8
  attr_reader :config
9
9
  attr_reader :value
10
10
 
11
- def initialize(msg = nil, value = nil)
11
+ def initialize(msg = nil, config = [], value = nil)
12
12
  @value = value
13
+ @config = config.join('.')
13
14
 
14
15
  super(msg)
15
16
  end
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'ultra_config'
7
- spec.version = '0.12.0'
7
+ spec.version = '0.13.0'
8
8
  spec.authors = ['Gregory Kuruc']
9
9
  spec.email = ['gjk910327@gmail.com']
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultra_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Kuruc