Class: Qonfig::Commands::Definition::LoadFromSelf Private

Inherits:
Base
  • Object
show all
Defined in:
lib/qonfig/commands/definition/load_from_self.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.2.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inheritable=, inheritable?, #inheritable?, inherited

Constructor Details

#initialize(caller_location, format:) ⇒ LoadFromSelf

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

Parameters:

  • caller_location (String)
  • format (Hash)

    a customizable set of options

Options Hash (format:):

  • (String, Symbol)

Since:

  • 0.2.0



26
27
28
29
30
31
32
33
# File 'lib/qonfig/commands/definition/load_from_self.rb', line 26

def initialize(caller_location, format:)
  unless format.is_a?(String) || format.is_a?(Symbol)
    raise Qonfig::ArgumentError, 'Format should be a symbol or a string'
  end

  @caller_location = caller_location
  @format = format.tap { Qonfig::Loaders.resolve(format) }
end

Instance Attribute Details

#caller_locationString (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)

Since:

  • 0.2.0



19
20
21
# File 'lib/qonfig/commands/definition/load_from_self.rb', line 19

def caller_location
  @caller_location
end

#formatString, Symbol (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, Symbol)

Since:

  • 0.15.0



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

def format
  @format
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.2.0



41
42
43
44
45
46
# File 'lib/qonfig/commands/definition/load_from_self.rb', line 41

def call(data_set, settings)
  self_placed_end_data = load_self_placed_end_data
  self_placed_settings = build_data_set_klass(self_placed_end_data).new.settings

  settings.__append_settings__(self_placed_settings)
end