Module: Qonfig::Settings::Builder Private

Defined in:
lib/qonfig/settings/builder.rb

Overview

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

Since:

  • 0.2.0

Class Method Summary collapse

Class Method Details

.build(data_set, &assignements) {|settings, validator| ... } ⇒ 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:

Yields:

  • (settings, validator)

Yield Parameters:

Since:

  • 0.21.0



16
17
18
19
20
21
22
# File 'lib/qonfig/settings/builder.rb', line 16

def build(data_set, &assignements)
  validator = build_validator(data_set)
  settings = build_definitions(data_set)
  yield(settings, validator)
  validator.validate!
  build_state(data_set)
end

.build_definitions(data_set) ⇒ Qonfig::Settings

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.

Parameters:

Returns:

Since:

  • 0.19.0



29
30
31
32
33
34
35
# File 'lib/qonfig/settings/builder.rb', line 29

def build_definitions(data_set)
  Qonfig::Settings.new(build_mutation_callbacks(data_set)).tap do |settings|
    data_set.class.definition_commands.dup.each do |command|
      command.call(data_set, settings)
    end
  end
end

.build_state(data_set) ⇒ 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.19.0



42
43
44
45
46
# File 'lib/qonfig/settings/builder.rb', line 42

def build_state(data_set)
  data_set.class.instance_commands.dup.each do |command|
    command.call(data_set, data_set.settings)
  end
end