Class: ConfigSynthesizer
- Inherits:
-
AbstractSynthesizer
- Object
- AbstractSynthesizer
- ConfigSynthesizer
- Includes:
- Constants
- Defined in:
- lib/pangea/synthesizer/config.rb
Overview
read files merge config data and provide a single configuation structure
Constant Summary
Constants included from Constants
Constants::ARTIFACT_FILE, Constants::CACHE_DIR, Constants::EXTENSIONS, Constants::PROJECT_SRC_DIRS, Constants::PROJECT_VERSION
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/pangea/synthesizer/config.rb', line 31 def method_missing(method_name, *args, &block) abstract_method_missing( method_name, %i[namespace], *args, &block ) 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/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 |