konfig-config 2.1.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/konfig/schema_attribute.rb +9 -1
- data/lib/konfig/schema_group.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5d08d47345c70e6c981e4ded9efc63b6f7d487d95cab858b9d382d54e71867d
|
4
|
+
data.tar.gz: b3f60ed43db9edd6e9adc7f8530052e30c23712f2865c9486a85c87b25c321f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2802f9dd009b74286ad3667da4b8a8f86a9ad874a7167931b5e87e8a3ea6f997aaab042883df2ecca1da61954fb76820b50ce1febaff4954c1cef0a3a68b9198
|
7
|
+
data.tar.gz: a1b01a125081dea459f98f4f738991b8d718706c1922fe60b8966e1d614457029827c73dfe61dd6aa36d23f6060bdf2812553e6d2acb3b3303694dfe99136f03
|
@@ -7,7 +7,8 @@ module Konfig
|
|
7
7
|
|
8
8
|
attr_reader :name
|
9
9
|
attr_reader :type
|
10
|
-
|
10
|
+
attr_writer :default
|
11
|
+
attr_accessor :transform_default
|
11
12
|
attr_accessor :description
|
12
13
|
attr_accessor :array
|
13
14
|
attr_accessor :transformer
|
@@ -18,6 +19,7 @@ module Konfig
|
|
18
19
|
self.type = type
|
19
20
|
@default = default
|
20
21
|
@description = description
|
22
|
+
@transform_default = false
|
21
23
|
@transformer = transformer
|
22
24
|
end
|
23
25
|
|
@@ -32,6 +34,12 @@ module Konfig
|
|
32
34
|
@type = type
|
33
35
|
end
|
34
36
|
|
37
|
+
def default
|
38
|
+
return [] if @default.nil? && array?
|
39
|
+
|
40
|
+
@default
|
41
|
+
end
|
42
|
+
|
35
43
|
def array?
|
36
44
|
@array == true
|
37
45
|
end
|
data/lib/konfig/schema_group.rb
CHANGED
@@ -30,7 +30,7 @@ module Konfig
|
|
30
30
|
@attributes.each_with_object({}) do |(name, attribute), hash|
|
31
31
|
attribute_path = path + [name]
|
32
32
|
if source.nil?
|
33
|
-
hash[name] = attribute.default
|
33
|
+
hash[name] = attribute.transform(attribute.default)
|
34
34
|
else
|
35
35
|
begin
|
36
36
|
source_value = source.get(attribute_path, attribute: attribute)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konfig-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|