Class: Standard::Performance::LoadsYamlWithInheritance

Inherits:
Object
  • Object
show all
Defined in:
lib/standard/performance/loads_yaml_with_inheritance.rb

Instance Method Summary collapse

Instance Method Details

#load(path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/standard/performance/loads_yaml_with_inheritance.rb', line 6

def load(path)
  yaml = YAML.load_file(path)
  if (parent_path = yaml.delete("inherit_from"))
    base_path = File.dirname(path)
    parent_yaml = load(File.join(base_path, parent_path))

    two_layer_merge(parent_yaml, yaml)
  else
    yaml
  end
end