Class: Completely::FlatConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/completely/flat_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ FlatConfig

Returns a new instance of FlatConfig.



5
6
7
8
# File 'lib/completely/flat_config.rb', line 5

def initialize(config)
  @options = config.delete('completely_options')&.transform_keys(&:to_sym) || {}
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/completely/flat_config.rb', line 3

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/completely/flat_config.rb', line 3

def options
  @options
end

Instance Method Details

#flat_configObject



10
11
12
13
14
15
16
17
18
# File 'lib/completely/flat_config.rb', line 10

def flat_config
  result = {}

  config.each do |root_key, root_list|
    result.merge! process_key(root_key, root_list)
  end

  result
end