fedux_org-stdlib 0.7.3 → 0.7.4
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/fedux_org_stdlib/app_config.rb +9 -9
- data/lib/fedux_org_stdlib/version.rb +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: 1a0581a33c7705e0cf383ee22339a250b3764ab7
|
4
|
+
data.tar.gz: dd8d1a40c3ac246d1f464c2d5aee980ae474e215
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74cceca59dfb67ed4588d7b633f3bfa8a9d22a672f0347963152f7308569300c6c22a14b05adcf4cf568e8383c358f9e0380bdb890893e03450427852d5528f1
|
7
|
+
data.tar.gz: bc80bccddfe93a02f30b4a76e878cf7ad86f406e51a375965d9498327041e11d81c0b9d03e97ac134708243e3492e4b71adb452fe2610edf139adc05c1834369
|
data/Gemfile.lock
CHANGED
@@ -71,8 +71,8 @@ module FeduxOrgStdlib
|
|
71
71
|
class AppConfig
|
72
72
|
class << self
|
73
73
|
|
74
|
-
#
|
75
|
-
def
|
74
|
+
# List known options
|
75
|
+
def known_options
|
76
76
|
@options ||= Set.new
|
77
77
|
end
|
78
78
|
|
@@ -104,7 +104,7 @@ module FeduxOrgStdlib
|
|
104
104
|
_config.fetch(option, default_value)
|
105
105
|
end
|
106
106
|
|
107
|
-
self.
|
107
|
+
self.known_options << option
|
108
108
|
end
|
109
109
|
|
110
110
|
# Define a writer for option
|
@@ -131,7 +131,7 @@ module FeduxOrgStdlib
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
self.
|
134
|
+
self.known_options << option
|
135
135
|
end
|
136
136
|
|
137
137
|
# Define a writer and a reader for option
|
@@ -205,12 +205,12 @@ module FeduxOrgStdlib
|
|
205
205
|
elsif yaml.kind_of? Hash
|
206
206
|
yaml = yaml.deep_symbolize_keys
|
207
207
|
|
208
|
-
|
209
|
-
unknown_options = yaml.keys -
|
208
|
+
yaml_withknown_options = yaml.deep_symbolize_keys.slice(*self.class.known_options)
|
209
|
+
unknown_options = yaml.keys - yaml_withknown_options.keys
|
210
210
|
|
211
211
|
logger.warn "Unknown config options #{(unknown_options).to_list} in config file #{file} detected. Please define them in your config class or remove the entries in your config file or disable check via `check_unknown_options: false` to get rid of this warning." unless unknown_options.blank? && check_unknown_options == true
|
212
212
|
|
213
|
-
@__config = Hash(
|
213
|
+
@__config = Hash(yaml_withknown_options)
|
214
214
|
else
|
215
215
|
logger.warn "There seems to be a problem transforming config file \"#{file}\" to a hash, therefor I will use an empty config object."
|
216
216
|
@__config = {}
|
@@ -228,13 +228,13 @@ module FeduxOrgStdlib
|
|
228
228
|
# An formatted version of the configuration
|
229
229
|
def to_s
|
230
230
|
# header 'length' = 6 letters
|
231
|
-
length = self.class.
|
231
|
+
length = self.class.known_options.inject(6) { |memo, o| o.size > memo ? o.size : memo }
|
232
232
|
|
233
233
|
result = []
|
234
234
|
result << sprintf("%#{length}s | %s", 'option', 'value')
|
235
235
|
result << sprintf("%s + %s", '-' * length, '-' * 80)
|
236
236
|
|
237
|
-
self.class.
|
237
|
+
self.class.known_options.each do |o|
|
238
238
|
value = public_send(o)
|
239
239
|
|
240
240
|
value = if value == false
|