fedux_org-stdlib 0.6.46 → 0.6.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/fedux_org_stdlib/app_config.rb +9 -5
- data/lib/fedux_org_stdlib/version.rb +1 -1
- data/spec/app_config_spec.rb +27 -0
- 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: 1ece173128292a383a56c8d916b0e6aae47d5961
|
4
|
+
data.tar.gz: f16e7f741547036b3bd0d60a9e8d623c602305d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2362f46430bb0e926f7448b0cb2ec667b5d5b3a0514043a2ff189acdeb99467c14cce5f54ebce49c238961e0fd340fe83a59cf82a3ee79b8b51f134241ba0ed
|
7
|
+
data.tar.gz: 85003a967218a9b182866e75f716f8b8e4d556c1f12f21714b0ee970401c4260cd52a8884bf8859add1009dc0e9c8af88db9bc8f272c1742c99a6cc521e63d23
|
data/Gemfile.lock
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
require 'fedux_org_stdlib/require_files'
|
3
3
|
require 'fedux_org_stdlib/app_config/exceptions'
|
4
4
|
require 'fedux_org_stdlib/process_environment'
|
5
|
-
require 'fedux_org_stdlib/core_ext/array'
|
5
|
+
require 'fedux_org_stdlib/core_ext/array/list'
|
6
|
+
require 'fedux_org_stdlib/core_ext/hash/list'
|
6
7
|
require 'fedux_org_stdlib/logging/logger'
|
7
8
|
require_library %w{ json psych active_support/core_ext/string/inflections set active_support/core_ext/hash/slice }
|
8
9
|
|
@@ -236,12 +237,15 @@ module FeduxOrgStdlib
|
|
236
237
|
self.class._known_options.each do |o|
|
237
238
|
value = public_send(o)
|
238
239
|
|
239
|
-
value = if value.
|
240
|
-
|
240
|
+
value = if value.blank?
|
241
|
+
Array('is undefined')
|
242
|
+
elsif value.is_a?(Hash) || value.is_a?(Array)
|
243
|
+
value
|
241
244
|
else
|
242
|
-
Array(value)
|
245
|
+
Array(value)
|
243
246
|
end
|
244
|
-
|
247
|
+
|
248
|
+
result << sprintf("%#{length}s | %s", o, value.to_list)
|
245
249
|
end
|
246
250
|
|
247
251
|
result.join("\n")
|
data/spec/app_config_spec.rb
CHANGED
@@ -364,5 +364,32 @@ RSpec.describe AppConfig do
|
|
364
364
|
EOS
|
365
365
|
end
|
366
366
|
end
|
367
|
+
|
368
|
+
it 'outputs is undefined for blank values (nil, '', ...)' do
|
369
|
+
with_environment 'HOME' => working_directory do
|
370
|
+
config_klass = Class.new(AppConfig) do
|
371
|
+
option :opt1, nil
|
372
|
+
option :opt2, ''
|
373
|
+
option :opt3, 'asdf'
|
374
|
+
|
375
|
+
def _class_name
|
376
|
+
'TestConfig'
|
377
|
+
end
|
378
|
+
|
379
|
+
def _module_name
|
380
|
+
'MyApplication'
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
config = config_klass.new
|
385
|
+
expect(config.to_s).to eq <<-EOS.strip_heredoc.chomp
|
386
|
+
option | value
|
387
|
+
------ + --------------------------------------------------------------------------------
|
388
|
+
opt1 | "is undefined"
|
389
|
+
opt2 | "is undefined"
|
390
|
+
opt3 | "asdf"
|
391
|
+
EOS
|
392
|
+
end
|
393
|
+
end
|
367
394
|
end
|
368
395
|
end
|