This gem adds a method collapse!
to Hash.
Using collapse! merges a sub-hash with self while applying set union to any common arrays.
:foo:
- a
- b
- d
:bar:
:foo:
- b
- d
- e
tmp = YAML.load_file 'example_config.yml'
tmp.inspect # => {:foo => ['a', 'b', 'd'], :bar => {:foo => ['b', 'd', 'e']}}
tmp.collapse! :bar
tmp.inspect # => {:foo => ['a', 'b', 'd', 'e']}
Amiel Martin