Class: Dotsync::ConfigMerger
- Inherits:
-
Object
- Object
- Dotsync::ConfigMerger
- Defined in:
- lib/dotsync/utils/config_merger.rb
Instance Attribute Summary collapse
-
#include_path ⇒ Object
readonly
Returns the value of attribute include_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config_hash, config_path) ⇒ ConfigMerger
constructor
A new instance of ConfigMerger.
- #resolve ⇒ Object
Constructor Details
#initialize(config_hash, config_path) ⇒ ConfigMerger
Returns a new instance of ConfigMerger.
13 14 15 16 17 |
# File 'lib/dotsync/utils/config_merger.rb', line 13 def initialize(config_hash, config_path) @config = config_hash @config_path = config_path @include_path = nil end |
Instance Attribute Details
#include_path ⇒ Object (readonly)
Returns the value of attribute include_path.
7 8 9 |
# File 'lib/dotsync/utils/config_merger.rb', line 7 def include_path @include_path end |
Class Method Details
.resolve(config_hash, config_path) ⇒ Object
9 10 11 |
# File 'lib/dotsync/utils/config_merger.rb', line 9 def self.resolve(config_hash, config_path) new(config_hash, config_path).resolve end |
Instance Method Details
#resolve ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/dotsync/utils/config_merger.rb', line 19 def resolve return @config unless @config.key?("include") validate_include_value! @include_path = resolve_include_path validate_include_exists! base_config = load_base_config validate_no_chained_includes!(base_config) merged = deep_merge(base_config, ) merged end |