fedux_org-stdlib 0.7.4 → 0.7.5

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: 1a0581a33c7705e0cf383ee22339a250b3764ab7
4
- data.tar.gz: dd8d1a40c3ac246d1f464c2d5aee980ae474e215
3
+ metadata.gz: dc0a196b126b4e30907761028202f93c5af01d7b
4
+ data.tar.gz: 031a51de4aaa8ff386e361d9cfdeb99ff12640f5
5
5
  SHA512:
6
- metadata.gz: 74cceca59dfb67ed4588d7b633f3bfa8a9d22a672f0347963152f7308569300c6c22a14b05adcf4cf568e8383c358f9e0380bdb890893e03450427852d5528f1
7
- data.tar.gz: bc80bccddfe93a02f30b4a76e878cf7ad86f406e51a375965d9498327041e11d81c0b9d03e97ac134708243e3492e4b71adb452fe2610edf139adc05c1834369
6
+ metadata.gz: f2efff3e23bc3088d79fe548b155490a76acd412840f58b2e3a52b19396b734e4a5a689b9de63a1926c6120cc72e0bb5f09b3aa51e0fb87646ea37a70e752dc4
7
+ data.tar.gz: 1c6ecf6db87829858c3a5395c26b8fa28730d21f1e169818bd01b0384b804fdf4effa8dc3133be07093903b8295ac73a76eb6d85a0e0f7d3436f6584d440b42e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fedux_org-stdlib (0.7.3)
4
+ fedux_org-stdlib (0.7.4)
5
5
  activesupport
6
6
 
7
7
  PATH
@@ -71,7 +71,7 @@ module FeduxOrgStdlib
71
71
  class AppConfig
72
72
  class << self
73
73
 
74
- # List known options
74
+ # @api private
75
75
  def known_options
76
76
  @options ||= Set.new
77
77
  end
@@ -205,7 +205,7 @@ module FeduxOrgStdlib
205
205
  elsif yaml.kind_of? Hash
206
206
  yaml = yaml.deep_symbolize_keys
207
207
 
208
- yaml_withknown_options = yaml.deep_symbolize_keys.slice(*self.class.known_options)
208
+ yaml_withknown_options = yaml.deep_symbolize_keys.slice(*self.known_options)
209
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
@@ -217,6 +217,11 @@ module FeduxOrgStdlib
217
217
  end
218
218
  end
219
219
 
220
+ # Show known options for configuration
221
+ def known_options
222
+ self.class.known_options
223
+ end
224
+
220
225
  # Lock the configuration
221
226
  def lock
222
227
  _config.freeze
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
  # FeduxOrgStdlib
3
3
  module FeduxOrgStdlib
4
- VERSION = '0.7.4'
4
+ VERSION = '0.7.5'
5
5
  end
@@ -371,6 +371,7 @@ RSpec.describe AppConfig do
371
371
  option :opt1, nil
372
372
  option :opt2, ''
373
373
  option :opt3, 'asdf'
374
+ option :opt4, false
374
375
 
375
376
  def _class_name
376
377
  'TestConfig'
@@ -388,8 +389,33 @@ RSpec.describe AppConfig do
388
389
  opt1 | "is undefined"
389
390
  opt2 | "is undefined"
390
391
  opt3 | "asdf"
392
+ opt4 | "false"
391
393
  EOS
392
394
  end
393
395
  end
394
396
  end
397
+
398
+ context '#known_options' do
399
+ it 'outputs a list of known options' do
400
+ with_environment 'HOME' => working_directory do
401
+ config_klass = Class.new(AppConfig) do
402
+ option :opt1, 'test1'
403
+ option :opt2, 'test2'
404
+ option :opt3, { opt1: 'test1', opt2: 'test2' }
405
+
406
+ def _class_name
407
+ 'TestConfig'
408
+ end
409
+
410
+ def _module_name
411
+ 'MyApplication'
412
+ end
413
+ end
414
+
415
+ config = config_klass.new
416
+ expect(config.known_options).to include :opt1, :opt2, :opt3
417
+ expect(config.class.known_options).to eq config.known_options
418
+ end
419
+ end
420
+ end
395
421
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fedux_org-stdlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.4
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Meyer