Ruby YAML with support for including and merging additional YAML files
MIT License
ExtendedYAML adds a couple of additional features to the standard YAML library:
extends: other_file
It is a simpler reimplementation of yaml_extend.
$ gem install extended_yaml
Given this simple.yml file:
extends: subdir/production.yml
settings:
host: localhost
port: 80
which uses extends
to load this
subdir/production.yml file.
settings:
host: example.com
We can now load the extended YAML file like this:
# Load an extended YAML
require 'extended_yaml'
p ExtendedYAML.load 'examples/simple.yml'
#=> {"settings"=>{"host"=>"localhost", "port"=>80}}
extends
option can use either a single file string, or an array.*
anywhere in the extends
path will load multiple files with oneextends
, providekey
keyword argument:
ExtendedYAML.load 'examples/simple.yml', key: 'include'
See the examples/master.yml file for additional information.