Sha256: c2dda302bb9a1820b011196a0a2c53ebb7e0ba7a66bcda98eabde36081ef74aa
Contents?: true
Size: 1.17 KB
Versions: 12
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true # @api private # @since 0.1.0 class Qonfig::Commands::Definition::Compose < Qonfig::Commands::Base # @since 0.19.0 self.inheritable = true # @return [Qonfig::DataSet] # # @api private # @since 0.1.0 attr_reader :composable_data_set_klass # @param composable_data_set_klass [Qonfig::DataSet] # # @raise [Qonfig::ArgumentError] # # @api private # @since 0.1.0 def initialize(composable_data_set_klass) unless composable_data_set_klass.is_a?(Class) && composable_data_set_klass < Qonfig::DataSet raise( Qonfig::ArgumentError, 'Composed config class should be a subtype of Qonfig::DataSet' ) end @composable_data_set_klass = composable_data_set_klass end # @param data_set [Qonfig::DataSet] # @param settings [Qonfig::Settings] # @return [void] # # @api private # @since 0.1.0 def call(data_set, settings) # NOTE: append new validators data_set.class.validators.concat(composable_data_set_klass.validators.dup) # NOTE: append new settings composite_settings = composable_data_set_klass.new.settings settings.__append_settings__(composite_settings) end end
Version data entries
12 entries across 12 versions & 1 rubygems