qonfig 0.18.1 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -0
  3. data/CHANGELOG.md +14 -0
  4. data/README.md +233 -34
  5. data/Rakefile +4 -2
  6. data/lib/qonfig/command_set.rb +14 -3
  7. data/lib/qonfig/commands/base.rb +37 -0
  8. data/lib/qonfig/commands/definition/add_nested_option.rb +3 -0
  9. data/lib/qonfig/commands/definition/add_option.rb +3 -0
  10. data/lib/qonfig/commands/definition/compose.rb +3 -0
  11. data/lib/qonfig/commands/definition/expose_json.rb +3 -0
  12. data/lib/qonfig/commands/definition/expose_self.rb +3 -0
  13. data/lib/qonfig/commands/definition/expose_yaml.rb +3 -0
  14. data/lib/qonfig/commands/definition/load_from_env.rb +3 -0
  15. data/lib/qonfig/commands/definition/load_from_json.rb +3 -0
  16. data/lib/qonfig/commands/definition/load_from_self.rb +3 -0
  17. data/lib/qonfig/commands/definition/load_from_yaml.rb +3 -0
  18. data/lib/qonfig/commands/instantiation/freeze_state.rb +18 -0
  19. data/lib/qonfig/commands/instantiation/values_file.rb +3 -0
  20. data/lib/qonfig/commands/instantiation.rb +1 -0
  21. data/lib/qonfig/data_set/class_builder.rb +11 -0
  22. data/lib/qonfig/data_set.rb +44 -16
  23. data/lib/qonfig/dsl.rb +10 -3
  24. data/lib/qonfig/errors.rb +24 -5
  25. data/lib/qonfig/plugins/abstract.rb +30 -1
  26. data/lib/qonfig/plugins/access_mixin.rb +11 -0
  27. data/lib/qonfig/plugins/pretty_print/data_set.rb +9 -0
  28. data/lib/qonfig/plugins/pretty_print/mixin.rb +24 -0
  29. data/lib/qonfig/plugins/pretty_print.rb +16 -0
  30. data/lib/qonfig/plugins/registry.rb +21 -0
  31. data/lib/qonfig/plugins/toml.rb +2 -2
  32. data/lib/qonfig/plugins.rb +15 -0
  33. data/lib/qonfig/settings/builder.rb +13 -2
  34. data/lib/qonfig/settings.rb +75 -8
  35. data/lib/qonfig/version.rb +1 -1
  36. data/lib/qonfig.rb +2 -0
  37. data/qonfig.gemspec +1 -1
  38. metadata +12 -2
@@ -3,6 +3,9 @@
3
3
  # @api private
4
4
  # @since 0.2.0
5
5
  class Qonfig::Commands::Definition::LoadFromYAML < Qonfig::Commands::Base
6
+ # @since 0.19.0
7
+ self.inheritable = true
8
+
6
9
  # @return [String]
7
10
  #
8
11
  # @api private
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @api private
4
+ # @since 0.19.0
5
+ class Qonfig::Commands::Instantiation::FreezeState < Qonfig::Commands::Base
6
+ # @since 0.19.0
7
+ self.inheritable = false
8
+
9
+ # @param data_set [Qonfig::DataSet]
10
+ # @param settings [Qonfig::Settings]
11
+ # @return [void]
12
+ #
13
+ # @api private
14
+ # @since 0.19.0
15
+ def call(data_set, settings)
16
+ settings.__freeze__
17
+ end
18
+ end
@@ -3,6 +3,9 @@
3
3
  # @api private
4
4
  # @since 0.17.0
5
5
  class Qonfig::Commands::Instantiation::ValuesFile < Qonfig::Commands::Base
6
+ # @since 0.19.0
7
+ self.inheritable = true
8
+
6
9
  # @return [Symbol]
7
10
  #
8
11
  # @api private
@@ -4,4 +4,5 @@
4
4
  # @since 0.17.0
5
5
  module Qonfig::Commands::Instantiation
6
6
  require_relative 'instantiation/values_file'
7
+ require_relative 'instantiation/freeze_state'
7
8
  end
@@ -23,5 +23,16 @@ module Qonfig::DataSet::ClassBuilder
23
23
  end
24
24
  end
25
25
  end
26
+
27
+ # @option base_klass [Class<Qonfig::DataSet>]
28
+ # @option child_klass [Class<Qonfig::DataSet>]
29
+ # @return [void]
30
+ #
31
+ # @api private
32
+ # @since 0.19.0
33
+ def inherit(base_klass:, child_klass:)
34
+ child_klass.definition_commands.concat(base_klass.definition_commands)
35
+ child_klass.instance_commands.concat(base_klass.instance_commands, &:inheritable?)
36
+ end
26
37
  end
27
38
  end
@@ -26,6 +26,18 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
26
26
 
27
27
  Class.new(base_dataset_klass, &config_klass_definitions).new
28
28
  end
29
+
30
+ # @param configurations [Hash<Symbol|String,Any>]
31
+ # @return [Boolean]
32
+ #
33
+ # @api public
34
+ # @since 0.19.0
35
+ def valid_with?(configurations = {})
36
+ new(configurations)
37
+ true
38
+ rescue Qonfig::ValidationError
39
+ false
40
+ end
29
41
  end
30
42
 
31
43
  # @return [Qonfig::Settings]
@@ -302,6 +314,26 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
302
314
  thread_safe_access { validator.valid? }
303
315
  end
304
316
 
317
+ # @param configurations [Hash<String,Symbol|Any>]
318
+ # @return [Boolean]
319
+ #
320
+ # @api public
321
+ # @since 0.19.0
322
+ def valid_with?(configurations = {})
323
+ # NOTE:
324
+ # 'dup.configure(configurations)' has better thread-safety than 'with(configurations)'
325
+ # pros:
326
+ # - no arbitrary lock is obtained;
327
+ # - all threads can read and work :)
328
+ # cons:
329
+ # - useless ton of objects (new dataset, new settings, new locks, and etc);
330
+ # - useless setting options assignment steps (self.dup + self.to_h + configure(to_h))
331
+ dup.configure(configurations)
332
+ true
333
+ rescue Qonfig::ValidationError
334
+ false
335
+ end
336
+
305
337
  # @return [void]
306
338
  #
307
339
  # @api public
@@ -405,9 +437,11 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
405
437
  #
406
438
  # @api private
407
439
  # @since 0.2.0
440
+ # @version 0.19.0
408
441
  def build_settings
409
- @settings = Qonfig::Settings::Builder.build(self)
442
+ @settings = Qonfig::Settings::Builder.build_definitions(self)
410
443
  validator.validate!
444
+ Qonfig::Settings::Builder.build_state(self)
411
445
  end
412
446
 
413
447
  # @return [void]
@@ -429,16 +463,6 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
429
463
  yield(settings) if block_given?
430
464
  end
431
465
 
432
- # @return [void]
433
- #
434
- # @api private
435
- # @since 0.17.0
436
- def call_instance_management_commands
437
- self.class.instance_commands.each do |instance_command|
438
- instance_command.call(self, settings)
439
- end
440
- end
441
-
442
466
  # @param settings_map [Hash]
443
467
  # @param configurations [Proc]
444
468
  # @return [void]
@@ -448,7 +472,6 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
448
472
  def load!(settings_map = {}, &configurations)
449
473
  build_validator
450
474
  build_settings
451
- call_instance_management_commands
452
475
  apply_settings(settings_map, &configurations)
453
476
  end
454
477
 
@@ -475,8 +498,8 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
475
498
  ).call(self, settings)
476
499
  end
477
500
 
478
- # @param instructions [Proc]
479
- # @return [Object]
501
+ # @param instructions [Block]
502
+ # @return [Any]
480
503
  #
481
504
  # @api private
482
505
  # @since 0.2.0
@@ -484,8 +507,8 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
484
507
  @__lock__.thread_safe_access(&instructions)
485
508
  end
486
509
 
487
- # @param instructions [Proc]
488
- # @return [Object]
510
+ # @param instructions [Block]
511
+ # @return [Any]
489
512
  #
490
513
  # @api private
491
514
  # @since 0.2.0
@@ -493,6 +516,11 @@ class Qonfig::DataSet # rubocop:disable Metrics/ClassLength
493
516
  @__lock__.thread_safe_definition(&instructions)
494
517
  end
495
518
 
519
+ # @param instructions [Block]
520
+ # @return [Any]
521
+ #
522
+ # @api priavte
523
+ # @since 0.17.0
496
524
  def with_arbitary_access(&instructions)
497
525
  @__lock__.with_arbitary_access(&instructions)
498
526
  end
data/lib/qonfig/dsl.rb CHANGED
@@ -9,6 +9,7 @@ module Qonfig::DSL
9
9
  #
10
10
  # @api private
11
11
  # @since 0.1.0
12
+ # @version 0.19.0
12
13
  def extended(child_klass)
13
14
  child_klass.instance_variable_set(:@definition_commands, Qonfig::CommandSet.new)
14
15
  child_klass.instance_variable_set(:@instance_commands, Qonfig::CommandSet.new)
@@ -17,9 +18,7 @@ module Qonfig::DSL
17
18
  def inherited(child_klass)
18
19
  child_klass.instance_variable_set(:@definition_commands, Qonfig::CommandSet.new)
19
20
  child_klass.instance_variable_set(:@instance_commands, Qonfig::CommandSet.new)
20
-
21
- child_klass.definition_commands.concat(definition_commands)
22
- child_klass.instance_commands.concat(instance_commands)
21
+ Qonfig::DataSet::ClassBuilder.inherit(base_klass: self, child_klass: child_klass)
23
22
  super
24
23
  end
25
24
  end)
@@ -183,4 +182,12 @@ module Qonfig::DSL
183
182
  file_path, caller_location, format: format, strict: strict, expose: expose
184
183
  )
185
184
  end
185
+
186
+ # @return [void]
187
+ #
188
+ # @api public
189
+ # @since 0.19.0
190
+ def freeze_state!
191
+ instance_commands << Qonfig::Commands::Instantiation::FreezeState.new
192
+ end
186
193
  end
data/lib/qonfig/errors.rb CHANGED
@@ -9,10 +9,18 @@ module Qonfig
9
9
  # @since 0.1.0
10
10
  ArgumentError = Class.new(ArgumentError)
11
11
 
12
+ # @see Qonfig::Validator::Builder::AttributeConsistency
13
+ # @see Qonfig::Validator::Predefined::Registry
14
+ #
12
15
  # @api public
13
16
  # @since 0.13.0
14
17
  ValidatorArgumentError = Class.new(ArgumentError)
15
18
 
19
+ # @see Qonfig::Validator
20
+ # @see Qonfig::Validator::MethodBased
21
+ # @see Qonfig::Validator::ProcBased
22
+ # @see Qonfig::Validator::Predefined::Common
23
+ #
16
24
  # @api public
17
25
  # @since 0.13.0
18
26
  ValidationError = Class.new(Error)
@@ -39,6 +47,12 @@ module Qonfig
39
47
  # @since 0.1.0
40
48
  UnknownSettingError = Class.new(Error)
41
49
 
50
+ # @see Qonfig::Settings
51
+ #
52
+ # @api private
53
+ # @since 0.19.0
54
+ StrangeThingsError = Class.new(Error)
55
+
42
56
  # @see Qonfig::Settings
43
57
  #
44
58
  # @api public
@@ -54,12 +68,9 @@ module Qonfig
54
68
  # @since 0.2.0
55
69
  CoreMethodIntersectionError = Class.new(Error)
56
70
 
57
- # @see Qonfig::Settings
58
- # @see Qonfig::DataSet
59
- #
60
71
  # @api public
61
- # @since 0.1.0
62
- FrozenSettingsError = begin # rubocop:disable Naming/ConstantName
72
+ # @since 0.19.0
73
+ FrozenError = begin # rubocop:disable Naming/ConstantName
63
74
  # :nocov:
64
75
  if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
65
76
  Class.new(::FrozenError)
@@ -69,6 +80,14 @@ module Qonfig
69
80
  # :nocov:
70
81
  end
71
82
 
83
+ # @see Qonfig::Settings
84
+ # @see Qonfig::DataSet
85
+ #
86
+ # @api public
87
+ # @since 0.1.0
88
+ # @version 0.19.0
89
+ FrozenSettingsError = Class.new(FrozenError)
90
+
72
91
  # @see Qonfig::Commands::Instantiation::ValuesFile
73
92
  #
74
93
  # @api public
@@ -4,10 +4,39 @@
4
4
  # @since 0.4.0
5
5
  class Qonfig::Plugins::Abstract
6
6
  class << self
7
+ # @param child_klass [Class]
8
+ # @return [void]
9
+ #
10
+ # @api private
11
+ # @since 0.19.0
12
+ def inherited(child_klass)
13
+ child_klass.instance_variable_set(:@loaded, false)
14
+ super
15
+ end
16
+
7
17
  # @return [void]
8
18
  #
9
19
  # @api private
10
20
  # @since 0.4.0
11
- def load!; end
21
+ def load!
22
+ @loaded = true
23
+ install!
24
+ end
25
+
26
+ # @return [Boolean]
27
+ #
28
+ # @api private
29
+ # @since 0.19.0
30
+ def loaded?
31
+ @loaded
32
+ end
33
+
34
+ private
35
+
36
+ # @return [void]
37
+ #
38
+ # @api private
39
+ # @since 0.19.0
40
+ def install!; end
12
41
  end
13
42
  end
@@ -13,6 +13,8 @@ module Qonfig::Plugins::AccessMixin
13
13
  def plugin(plugin_name)
14
14
  Qonfig::Plugins.load(plugin_name)
15
15
  end
16
+ alias_method :enable, :plugin
17
+ alias_method :load, :plugin
16
18
 
17
19
  # @return [Array<String>]
18
20
  #
@@ -24,6 +26,15 @@ module Qonfig::Plugins::AccessMixin
24
26
  Qonfig::Plugins.names
25
27
  end
26
28
 
29
+ # @return [Array<String>]
30
+ #
31
+ # @api private
32
+ # @since 0.19.0
33
+ def loaded_plugins
34
+ Qonfig::Plugins.loaded_plugins
35
+ end
36
+ alias_method :enabled_plugins, :loaded_plugins
37
+
27
38
  # @param plugin_name [String, Symbol]
28
39
  # @param plugin_klass [Class<Qonfig::Plugins::Abstract>]
29
40
  # @return [void]
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @api public
4
+ # @since 0.19.0
5
+ class Qonfig::DataSet
6
+ # @api public
7
+ # @since 0.19.0
8
+ include Qonfig::Plugins::PrettyPrint::Mixin
9
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @api private
4
+ # @since 0.19.0
5
+ module Qonfig::Plugins::PrettyPrint::Mixin
6
+ # @param pp [?] Suitable for Ruby's PP module
7
+ # @return [void]
8
+ #
9
+ # @api public
10
+ # @since 0.19.0
11
+ def pretty_print(pp)
12
+ pp.object_address_group(self) do
13
+ pp.seplist(keys, proc { pp.text(',') }) do |key|
14
+ pp.breakable(' ')
15
+ pp.group(1) do
16
+ pp.text(key)
17
+ pp.text(':')
18
+ pp.breakable
19
+ pp.pp(self[key])
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @api private
4
+ # @since 0.19.0
5
+ class Qonfig::Plugins::PrettyPrint < Qonfig::Plugins::Abstract
6
+ class << self
7
+ # @return [void]
8
+ #
9
+ # @api private
10
+ # @since 0.19.0
11
+ def install!
12
+ require_relative 'pretty_print/mixin'
13
+ require_relative 'pretty_print/data_set'
14
+ end
15
+ end
16
+ end
@@ -3,6 +3,9 @@
3
3
  # @api private
4
4
  # @since 0.4.0
5
5
  class Qonfig::Plugins::Registry
6
+ # @since 0.19.0
7
+ include Enumerable
8
+
6
9
  # @return [void]
7
10
  #
8
11
  # @api private
@@ -40,6 +43,15 @@ class Qonfig::Plugins::Registry
40
43
  thread_safe { plugin_names }
41
44
  end
42
45
 
46
+ # @param block [Block]
47
+ # @return [Enumerable]
48
+ #
49
+ # @api private
50
+ # @since 0.19.0
51
+ def each(&block)
52
+ thread_safe { iterate(&block) }
53
+ end
54
+
43
55
  private
44
56
 
45
57
  # @return [Hash]
@@ -70,6 +82,15 @@ class Qonfig::Plugins::Registry
70
82
  plugin_set.keys
71
83
  end
72
84
 
85
+ # @param block [Block]
86
+ # @return [Enumerable]
87
+ #
88
+ # @api private
89
+ # @since 0.19.0
90
+ def iterate(&block)
91
+ block_given? ? plugin_set.each_pair(&block) : plugin_set.each_pair
92
+ end
93
+
73
94
  # @param plugin_name [String]
74
95
  # @return [Boolean]
75
96
  #
@@ -7,8 +7,8 @@ class Qonfig::Plugins::TOML < Qonfig::Plugins::Abstract
7
7
  # @return [void]
8
8
  #
9
9
  # @api private
10
- # @since 0.12.0
11
- def load!
10
+ # @since 0.19.0
11
+ def install!
12
12
  raise(
13
13
  Qonfig::UnresolvedPluginDependencyError,
14
14
  '::TomlRB does not exist or "toml-rb" gem is not loaded'
@@ -7,6 +7,7 @@ module Qonfig::Plugins
7
7
  require_relative 'plugins/access_mixin'
8
8
  require_relative 'plugins/abstract'
9
9
  require_relative 'plugins/toml'
10
+ require_relative 'plugins/pretty_print'
10
11
 
11
12
  # @since 0.4.0
12
13
  @plugin_registry = Registry.new
@@ -23,6 +24,20 @@ module Qonfig::Plugins
23
24
  thread_safe { plugin_registry[plugin_name].load! }
24
25
  end
25
26
 
27
+ # @return [Array<String>]
28
+ #
29
+ # @api public
30
+ # @since 0.19.0
31
+ def loaded_plugins
32
+ thread_safe do
33
+ plugin_registry.select do |_plugin_name, plugin_module|
34
+ plugin_module.loaded?
35
+ end.map do |plugin_name, _plugin_module|
36
+ plugin_name
37
+ end
38
+ end
39
+ end
40
+
26
41
  # @return [Array<String>]
27
42
  #
28
43
  # @api public
@@ -8,8 +8,8 @@ module Qonfig::Settings::Builder
8
8
  # @return [Qonfig::Settings]
9
9
  #
10
10
  # @api private
11
- # @since 0.2.0
12
- def build(data_set)
11
+ # @since 0.19.0
12
+ def build_definitions(data_set)
13
13
  Qonfig::Settings.new(build_mutation_callbacks(data_set)).tap do |settings|
14
14
  data_set.class.definition_commands.dup.each do |command|
15
15
  command.call(data_set, settings)
@@ -17,6 +17,17 @@ module Qonfig::Settings::Builder
17
17
  end
18
18
  end
19
19
 
20
+ # @param data_set [Qonfig::DataSet]
21
+ # @return [void]
22
+ #
23
+ # @api private
24
+ # @since 0.19.0
25
+ def build_state(data_set)
26
+ data_set.class.instance_commands.dup.each do |command|
27
+ command.call(data_set, data_set.settings)
28
+ end
29
+ end
30
+
20
31
  private
21
32
 
22
33
  # @param data_set [Qonfig::DataSet]
@@ -22,6 +22,12 @@ class Qonfig::Settings # NOTE: Layout/ClassStructure is disabled only for CORE_M
22
22
  # @since 0.11.0
23
23
  BASIC_SETTING_VALUE_TRANSFORMER = (proc { |value| value }).freeze
24
24
 
25
+ # @return [String]
26
+ #
27
+ # @api private
28
+ # @since 0.19.0
29
+ DOT_NOTATION_SEPARATOR = '.'
30
+
25
31
  # @return [Hash]
26
32
  #
27
33
  # @api private
@@ -128,7 +134,13 @@ class Qonfig::Settings # NOTE: Layout/ClassStructure is disabled only for CORE_M
128
134
  # @api public
129
135
  # @since 0.1.0
130
136
  def [](key)
131
- __lock__.thread_safe_access { __get_value__(key) }
137
+ __lock__.thread_safe_access do
138
+ begin
139
+ __get_value__(key)
140
+ rescue Qonfig::UnknownSettingError
141
+ __deep_access__(*__parse_dot_notated_key__(key))
142
+ end
143
+ end
132
144
  end
133
145
 
134
146
  # @param key [String, Symbol]
@@ -156,7 +168,17 @@ class Qonfig::Settings # NOTE: Layout/ClassStructure is disabled only for CORE_M
156
168
  # @api private
157
169
  # @since 0.2.0
158
170
  def __dig__(*keys)
159
- __lock__.thread_safe_access { __deep_access__(*keys) }
171
+ __lock__.thread_safe_access do
172
+ begin
173
+ __deep_access__(*keys)
174
+ rescue Qonfig::UnknownSettingError
175
+ if keys.size == 1
176
+ __deep_access__(*__parse_dot_notated_key__(keys.first))
177
+ else
178
+ raise
179
+ end
180
+ end
181
+ end
160
182
  end
161
183
 
162
184
  # @param keys [Array<String, Symbol>]
@@ -342,7 +364,16 @@ class Qonfig::Settings # NOTE: Layout/ClassStructure is disabled only for CORE_M
342
364
  # @api private
343
365
  # @since 0.17.0
344
366
  def __is_key_exists__(*key_path)
345
- __deep_access__(*key_path)
367
+ begin
368
+ __deep_access__(*key_path)
369
+ rescue Qonfig::UnknownSettingError
370
+ if key_path.size == 1
371
+ __deep_access__(*__parse_dot_notated_key__(key_path.first))
372
+ else
373
+ raise
374
+ end
375
+ end
376
+
346
377
  true
347
378
  rescue Qonfig::UnknownSettingError
348
379
  false
@@ -526,9 +557,21 @@ class Qonfig::Settings # NOTE: Layout/ClassStructure is disabled only for CORE_M
526
557
  # @since 0.9.0
527
558
  def __deep_slice__(*keys)
528
559
  {}.tap do |result|
529
- __deep_access__(*keys).tap do |setting|
530
- required_key = __indifferently_accessable_option_key__(keys.last)
531
- result[required_key] = __is_a_setting__(setting) ? setting.__to_h__ : setting
560
+ begin
561
+ __deep_access__(*keys).tap do |setting|
562
+ required_key = __indifferently_accessable_option_key__(keys.last)
563
+ result[required_key] = __is_a_setting__(setting) ? setting.__to_h__ : setting
564
+ end
565
+ rescue Qonfig::UnknownSettingError
566
+ if keys.size == 1
567
+ key_set = __parse_dot_notated_key__(keys.first)
568
+ __deep_access__(*key_set).tap do |setting|
569
+ required_key = __indifferently_accessable_option_key__(key_set.last)
570
+ result[required_key] = __is_a_setting__(setting) ? setting.__to_h__ : setting
571
+ end
572
+ else
573
+ raise
574
+ end
532
575
  end
533
576
  end
534
577
  end
@@ -543,7 +586,22 @@ class Qonfig::Settings # NOTE: Layout/ClassStructure is disabled only for CORE_M
543
586
  # @since 0.1.0
544
587
  def __deep_slice_value__(*keys)
545
588
  required_key = __indifferently_accessable_option_key__(keys.last)
546
- __deep_slice__(*keys)[required_key]
589
+ sliced_data = __deep_slice__(*keys)
590
+
591
+ case
592
+ when sliced_data.key?(required_key)
593
+ sliced_data[required_key]
594
+ when keys.size == 1
595
+ required_key = __parse_dot_notated_key__(required_key).last
596
+ sliced_data[required_key]
597
+ else # NOTE: possibly unreachable code
598
+ # :nocov:
599
+ raise(
600
+ Qonfig::StrangeThingsError,
601
+ "Strange things happpens with #{keys} keyset and value slicing"
602
+ )
603
+ # :nocov:
604
+ end
547
605
  end
548
606
 
549
607
  # @param keys [Array<String, Symbol, Array<String, Symbol>>]
@@ -662,6 +720,15 @@ class Qonfig::Settings # NOTE: Layout/ClassStructure is disabled only for CORE_M
662
720
  KeyGuard.new(key).prevent_core_method_intersection!
663
721
  end
664
722
 
723
+ # @param key [String, Symbol]
724
+ # @return [Array<String>]
725
+ #
726
+ # @api private
727
+ # @since 0.19.0
728
+ def __parse_dot_notated_key__(key)
729
+ __indifferently_accessable_option_key__(key).split(DOT_NOTATION_SEPARATOR)
730
+ end
731
+
665
732
  # @return [Array<String>]
666
733
  #
667
734
  # @api private
@@ -669,7 +736,7 @@ class Qonfig::Settings # NOTE: Layout/ClassStructure is disabled only for CORE_M
669
736
  CORE_METHODS = Array(
670
737
  instance_methods(false) |
671
738
  private_instance_methods(false) |
672
- %i[super define_singleton_method self]
739
+ %i[super define_singleton_method self is_a?]
673
740
  ).map(&:to_s).freeze
674
741
  end
675
742
  # rubocop:enable Metrics/ClassLength, Layout/ClassStructure
@@ -5,5 +5,5 @@ module Qonfig
5
5
  #
6
6
  # @api public
7
7
  # @since 0.1.0
8
- VERSION = '0.18.1'
8
+ VERSION = '0.19.0'
9
9
  end
data/lib/qonfig.rb CHANGED
@@ -24,4 +24,6 @@ module Qonfig
24
24
 
25
25
  # @since 0.12.0
26
26
  register_plugin('toml', Qonfig::Plugins::TOML)
27
+ # @since 0.19.0
28
+ register_plugin('pretty_print', Qonfig::Plugins::PrettyPrint)
27
29
  end
data/qonfig.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_development_dependency 'coveralls', '~> 0.8'
33
33
  spec.add_development_dependency 'simplecov', '~> 0.16'
34
34
  spec.add_development_dependency 'rspec', '~> 3.8'
35
- spec.add_development_dependency 'armitage-rubocop', '~> 0.76'
35
+ spec.add_development_dependency 'armitage-rubocop', '~> 0.76', '>= 0.76.0.3'
36
36
 
37
37
  spec.add_development_dependency 'bundler'
38
38
  spec.add_development_dependency 'rake'