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

Methods inherited from Base

inheritable=, inheritable?, #inheritable?, inherited

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



21
22
23
24
25
26
27
28
29
30
# File 'lib/qonfig/commands/definition/compose.rb', line 21

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



13
14
15
# File 'lib/qonfig/commands/definition/compose.rb', line 13

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



38
39
40
41
42
43
44
45
# File 'lib/qonfig/commands/definition/compose.rb', line 38

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