Class: Qonfig::Commands::Definition::Compose Private

Inherits:
Base
  • Object
show all
Defined in:
lib/qonfig/commands/definition/compose.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(composable_data_set_klass) ⇒ Compose

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Compose.

Parameters:

Raises:

Since:

  • 0.1.0



18
19
20
21
22
23
24
25
26
27
# File 'lib/qonfig/commands/definition/compose.rb', line 18

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

Instance Attribute Details

#composable_data_set_klassQonfig::DataSet (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

Since:

  • 0.1.0



10
11
12
# File 'lib/qonfig/commands/definition/compose.rb', line 10

def composable_data_set_klass
  @composable_data_set_klass
end

Instance Method Details

#call(data_set, settings) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

Since:

  • 0.1.0



35
36
37
38
39
40
41
42
# File 'lib/qonfig/commands/definition/compose.rb', line 35

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