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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a22afc67d2963b64a215cd391ccaedfe7e06b8225380efd1e9d5617cc3ceaa19
4
- data.tar.gz: 2d6e3591b8dd6b439b291d89d56fd220f3494481046e78932bf42a5e7c6d7ee9
3
+ metadata.gz: d5d08d47345c70e6c981e4ded9efc63b6f7d487d95cab858b9d382d54e71867d
4
+ data.tar.gz: b3f60ed43db9edd6e9adc7f8530052e30c23712f2865c9486a85c87b25c321f9
5
5
  SHA512:
6
- metadata.gz: aa032900f8624afa1c9f3ffb4af0ba386beccd75ec475fed0ce065d1042eba90aa28d37a8a15dd6ea703ae882be4decad31059244c6a80c761dbe023173d7451
7
- data.tar.gz: e8c8319850a83410ea1bba2ba8b097049bad517c8fcaa25585e55b88ed6e3128e0bed03bde11a85a6e0cc80c48d3684258f7f18c3f850e80ea1c5a8bfb53c2fc
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
- attr_accessor :default
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
@@ -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: 2.1.1
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-02-25 00:00:00.000000000 Z
11
+ date: 2024-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie