Class: ERBLint::RunnerConfigResolver
- Inherits:
-
Object
- Object
- ERBLint::RunnerConfigResolver
- Defined in:
- lib/erb_lint/runner_config_resolver.rb
Instance Method Summary collapse
- #resolve_inheritance(hash, file_loader) ⇒ Object
- #resolve_inheritance_from_gems(hash, gems) ⇒ Object
Instance Method Details
#resolve_inheritance(hash, file_loader) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/erb_lint/runner_config_resolver.rb', line 26 def resolve_inheritance(hash, file_loader) inherited_files = Array(hash["inherit_from"]) base_configs(file_loader, inherited_files).reverse_each do |base_config| base_config.each do |k, v| next unless v.is_a?(Hash) v = v.deep_merge(hash[k]) if hash.key?(k) hash[k] = v end end end |
#resolve_inheritance_from_gems(hash, gems) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/erb_lint/runner_config_resolver.rb', line 38 def resolve_inheritance_from_gems(hash, gems) (gems || {}).each_pair do |gem_name, config_path| raise(ArgumentError, "can't inherit configuration from the erb_lint gem") if gem_name == "erb_lint" hash["inherit_from"] = Array(hash["inherit_from"]) Array(config_path).reverse_each do |path| # Put gem configuration first so local configuration overrides it. hash["inherit_from"].unshift(gem_config_path(gem_name, path)) end end end |