A psych handler and parser that allows inherit other files within YAML files.
It is an extraction from elasticsearch-rake-tasks.
Supports JRubys Psych implementation.
Installation
Add this line to your application's Gemfile:
gem 'psych-inherit-file'
And then execute:
$ bundle
Or install it yourself as:
$ gem install psych-inherit-file
Usage
Just use the Parser class instead of your YAML parser:
parser = Psych::Inherit::File::Parser.new
parser.parse_file('myfile.yaml')This parser allows you to include the following tag in your YAML:
# bar.yml
---
name: &string_analyzed
type: string# foo.yml
properties:
inherit: !file "bar.yml"
surname: *string_analyzed
This allows you to share definitions between files. The "inherit" node will be replaced by inherited file.
Contributors
- Sebastian Ziebell (original implementation)
- Florian Gilcher (extraction)
- Nico Hagenburger (quality control)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request