Class: Qonfig::Commands::Definition::LoadFromTOML Private

Inherits:
Base
  • Object
show all
Defined in:
lib/qonfig/plugins/toml/commands/definition/load_from_toml.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.12.0

Version:

  • 0.20.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inheritable=, inheritable?, #inheritable?, inherited

Constructor Details

#initialize(file_path, strict: true) ⇒ LoadFromTOML

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 LoadFromTOML.

Parameters:

  • file_path (String)
  • strict (Hash) (defaults to: true)

    a customizable set of options

Options Hash (strict:):

  • (Boolean)

Since:

  • 0.12.0



27
28
29
30
# File 'lib/qonfig/plugins/toml/commands/definition/load_from_toml.rb', line 27

def initialize(file_path, strict: true)
  @file_path = file_path
  @strict = strict
end

Instance Attribute Details

#file_pathString, Pathname (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:

  • (String, Pathname)

Since:

  • 0.12.0



14
15
16
# File 'lib/qonfig/plugins/toml/commands/definition/load_from_toml.rb', line 14

def file_path
  @file_path
end

#strictBoolean (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:

  • (Boolean)

Since:

  • 0.12.0



20
21
22
# File 'lib/qonfig/plugins/toml/commands/definition/load_from_toml.rb', line 20

def strict
  @strict
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.12.0



38
39
40
41
42
# File 'lib/qonfig/plugins/toml/commands/definition/load_from_toml.rb', line 38

def call(data_set, settings)
  toml_data = Qonfig::Loaders::TOML.load_file(file_path, fail_on_unexist: strict)
  toml_based_settings = build_data_set_klass(toml_data).new.settings
  settings.__append_settings__(toml_based_settings)
end