lib/qonfig/dsl.rb in qonfig-0.20.0 vs lib/qonfig/dsl.rb in qonfig-0.21.0

- old
+ new

@@ -2,12 +2,14 @@ # @api private # @since 0.1.0 # @version 0.20.0 module Qonfig::DSL # rubocop:disable Metrics/ModuleLength + require_relative 'dsl/inheritance' + class << self - # @param child_klass [Qonfig::DataSet] + # @param child_klass [Class<Qonfig::DataSet>] # @return [void] # # @see Qonfig::DataSet::ClassBuilder # # @api private @@ -24,11 +26,11 @@ def inherited(child_klass) child_klass.instance_variable_set(:@definition_commands, Qonfig::CommandSet.new) child_klass.instance_variable_set(:@instance_commands, Qonfig::CommandSet.new) child_klass.instance_variable_set(:@predefined_validators, Qonfig::Validation::Collections::PredefinedRegistry.new) child_klass.instance_variable_set(:@validators, Qonfig::Validation::Collections::InstanceCollection.new) - Qonfig::DataSet::ClassBuilder.inherit(base_klass: self, child_klass: child_klass) + Qonfig::DSL::Inheritance.inherit(base: self, child: child_klass) super end end) end # rubocop:enable Metrics/LineLength, Metrics/AbcSize @@ -164,18 +166,20 @@ definition_commands << Qonfig::Commands::Definition::LoadFromYAML.new( file_path, strict: strict ) end + # @option format [Symbol, String] # @return [void] # # @see Qonfig::Commands::Definition::LoadFromSelf # # @api public # @since 0.2.0 - def load_from_self(format: :yaml) - caller_location = caller(1, 1).first + # @version 0.21.0 + def load_from_self(format: :dynamic) + caller_location = ::Kernel.caller(1, 1).first definition_commands << Qonfig::Commands::Definition::LoadFromSelf.new( caller_location, format: format ) end @@ -239,18 +243,20 @@ file_path, strict: strict, via: via, env: env ) end # @option env [Symbol, String] + # @option format [Symbol, String] # @return [void] # # @see Qonfig::Commands::Definition::ExposeSelf # # @api public # @since 0.14.0 - def expose_self(env:, format: :yaml) - caller_location = caller(1, 1).first + # @version 0.21.0 + def expose_self(env:, format: :dynamic) + caller_location = ::Kernel.caller(1, 1).first definition_commands << Qonfig::Commands::Definition::ExposeSelf.new( caller_location, env: env, format: format ) end @@ -264,10 +270,10 @@ # @see Qonfig::Commands::Instantiation::ValuesFile # # @api public # @since 0.17.0 def values_file(file_path, format: :dynamic, strict: false, expose: nil) - caller_location = caller(1, 1).first + caller_location = ::Kernel.caller(1, 1).first instance_commands << Qonfig::Commands::Instantiation::ValuesFile.new( file_path, caller_location, format: format, strict: strict, expose: expose ) end