Class: ConfigSynthesizer

Inherits:
AbstractSynthesizer
  • Object
show all
Includes:
Constants
Defined in:
lib/pangea-orchestrator/synthesizer/config.rb

Overview

read files merge config data and provide a single configuation structure

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/pangea-orchestrator/synthesizer/config.rb', line 31

def method_missing(method_name, ...)
  abstract_method_missing(
    method_name,
    %i[namespace],
    ...
  )
end

Instance Method Details

#synthesize(content, ext) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pangea-orchestrator/synthesizer/config.rb', line 14

def synthesize(content, ext)
  case ext.to_s
  when %(yaml), %(yml)
    translation[:template] = YAML.safe_load(content)
  when %(toml)
    translation[:template] = TomlRB.parse(content)
  when %(json)
    translation[:template] = JSON.parse(content)
  when %(rb)
    if block_given?
      yield
    else
      instance_eval(content)
    end
  end
end