Class: Qonfig::Imports::General Private

Inherits:
Object
  • Object
show all
Defined in:
lib/qonfig/imports/general.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.18.0

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(seeded_klass, imported_config, *imported_keys, mappings: Qonfig::Imports::Mappings::EMPTY_MAPPINGS, prefix: Qonfig::Imports::Abstract::EMPTY_PREFIX, raw: Qonfig::Imports::Abstract::DEFAULT_RAW_BEHAVIOR, accessor: Qonfig::Imports::Abstract::AS_ACCESSOR) ⇒ General

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

Parameters:

  • seeded_klass (Class, Object)
  • imported_config (Qonfig::DataSet)
  • imported_keys (Array<String, Symbol>)
  • mappings (Hash) (defaults to: Qonfig::Imports::Mappings::EMPTY_MAPPINGS)

    a customizable set of options

  • prefix (Hash) (defaults to: Qonfig::Imports::Abstract::EMPTY_PREFIX)

    a customizable set of options

  • raw (Hash) (defaults to: Qonfig::Imports::Abstract::DEFAULT_RAW_BEHAVIOR)

    a customizable set of options

  • accessor (Hash) (defaults to: Qonfig::Imports::Abstract::AS_ACCESSOR)

    a customizable set of options

Options Hash (mappings:):

  • (Hash<String|Symbol,String|Symbol>)

Options Hash (prefix:):

  • (String, Symbol)

Options Hash (raw:):

  • (Boolean)

Options Hash (accessor:):

  • (Boolean)

Since:

  • 0.18.0

Version:

  • 0.21.0



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/qonfig/imports/general.rb', line 52

def initialize(
  seeded_klass,
  imported_config,
  *imported_keys,
  mappings: Qonfig::Imports::Mappings::EMPTY_MAPPINGS,
  prefix: Qonfig::Imports::Abstract::EMPTY_PREFIX,
  raw: Qonfig::Imports::Abstract::DEFAULT_RAW_BEHAVIOR,
  accessor: Qonfig::Imports::Abstract::AS_ACCESSOR
)
  @seeded_klass = seeded_klass

  @direct_key_importer = build_direct_key_importer(
    seeded_klass,
    imported_config,
    *imported_keys,
    prefix: prefix,
    raw: raw,
    accessor: accessor
  )

  @mappings_importer = build_mappings_importer(
    seeded_klass,
    imported_config,
    mappings: mappings,
    prefix: prefix,
    raw: raw,
    accessor: accessor
  )
end

Class Method Details

.import!(seeded_klass, imported_config, *imported_keys, mappings: Qonfig::Imports::Mappings::EMPTY_MAPPINGS, prefix: Qonfig::Imports::Abstract::EMPTY_PREFIX, raw: Qonfig::Imports::Abstract::DEFAULT_RAW_BEHAVIOR, accessor: Qonfig::Imports::Abstract::AS_ACCESSOR) ⇒ Object

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:

  • seeded_klass (Class, Object)
  • imported_config (Qonfig::DataSet)
  • imported_keys (Array<String, Symbol>)
  • mappings (Hash) (defaults to: Qonfig::Imports::Mappings::EMPTY_MAPPINGS)

    a customizable set of options

  • prefix (Hash) (defaults to: Qonfig::Imports::Abstract::EMPTY_PREFIX)

    a customizable set of options

  • raw (Hash) (defaults to: Qonfig::Imports::Abstract::DEFAULT_RAW_BEHAVIOR)

    a customizable set of options

  • accessor (Hash) (defaults to: Qonfig::Imports::Abstract::AS_ACCESSOR)

    a customizable set of options

Options Hash (mappings:):

  • (Hash<String|Symbol,String|Symbol>)

Options Hash (prefix:):

  • (String, Symbol)

Options Hash (raw:):

  • (Boolean)

Options Hash (accessor:):

  • (Boolean)

Since:

  • 0.18.0

Version:

  • 0.21.0



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/qonfig/imports/general.rb', line 19

def import!(
  seeded_klass,
  imported_config,
  *imported_keys,
  mappings: Qonfig::Imports::Mappings::EMPTY_MAPPINGS,
  prefix: Qonfig::Imports::Abstract::EMPTY_PREFIX,
  raw: Qonfig::Imports::Abstract::DEFAULT_RAW_BEHAVIOR,
  accessor: Qonfig::Imports::Abstract::AS_ACCESSOR
)
  new(
    seeded_klass,
    imported_config,
    *imported_keys,
    mappings: mappings,
    prefix: prefix,
    raw: raw,
    accessor: accessor
  ).import!
end

Instance Method Details

#import!(settings_interface = Module.new) ⇒ 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:

  • settings_interface (Module) (defaults to: Module.new)

Since:

  • 0.18.0



87
88
89
90
91
# File 'lib/qonfig/imports/general.rb', line 87

def import!(settings_interface = Module.new)
  direct_key_importer.import!(settings_interface)
  mappings_importer.import!(settings_interface)
  seeded_klass.include(settings_interface)
end