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

Version:

  • 0.29.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inheritable=, inheritable?, #inheritable?, inherited

Constructor Details

#initialize(caller_location, format:, replace_on_merge: false) ⇒ 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

  • replace_on_merge (Hash) (defaults to: false)

    a customizable set of options

Options Hash (format:):

  • (String, Symbol)

Options Hash (replace_on_merge:):

  • (Boolean)

Since:

  • 0.2.0

Version:

  • 0.29.0



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

def initialize(caller_location, format:, replace_on_merge: false)
  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) }
  @replace_on_merge = replace_on_merge
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



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

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



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

def format
  @format
end

#replace_on_mergeBoolean (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.29.0



26
27
28
# File 'lib/qonfig/commands/definition/load_from_self.rb', line 26

def replace_on_merge
  @replace_on_merge
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

Version:

  • 0.29.0



52
53
54
55
56
57
# File 'lib/qonfig/commands/definition/load_from_self.rb', line 52

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, with_redefinition: replace_on_merge)
end