https://github.com/200ok-ch/yaml_extensions
Extensions to make YAML even more useful
https://github.com/200ok-ch/yaml_extensions
Last synced: 9 days ago
JSON representation
Extensions to make YAML even more useful
- Host: GitHub
- URL: https://github.com/200ok-ch/yaml_extensions
- Owner: 200ok-ch
- License: mit
- Created: 2022-07-22T16:33:58.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-07-25T09:44:16.000Z (about 3 years ago)
- Last Synced: 2025-09-18T09:04:41.471Z (21 days ago)
- Language: Ruby
- Size: 10.7 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.org
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
* YamlExtensions
:PROPERTIES:
:CUSTOM_ID: yamlextensions
:END:Extensions to make YAML even more useful.
** Installation
:PROPERTIES:
:CUSTOM_ID: installation
:END:Add this line to your application's Gemfile:
#+BEGIN_SRC ruby
gem 'yaml_extensions'
#+END_SRCAnd then execute:
#+BEGIN_EXAMPLE
$ bundle install
#+END_EXAMPLEOr install it yourself as:
#+BEGIN_EXAMPLE
$ gem install yaml_extensions
#+END_EXAMPLE** Usage
:PROPERTIES:
:CUSTOM_ID: usage
:END:Just require =yaml_extensions=. For now this will [[https://twitter.com/dhh/status/813075241236762624][freedom patch]] the
YAML module to extend its functionality.#+begin_src ruby
require 'yaml_extensions'
#+end_srcDeep Merge any key-value-list by replacing YAML's regular Merge Key
=<<= with =<<<=. Example:#+begin_src yaml
defaults: &DEFAULTS
hello: world
this:
is:
even: deepermain:
<<<: *DEFAULTS
this:
is:
somewhat: deep
#+end_srcwill be interpreted as
#+begin_src yaml
defaults:
hello: world
this:
is:
even: deepermain:
this:
is:
somewhat: deep
even: deeper
hello: world
#+end_srcThis does not acutally patch the parser, but runs a transformation on
the already parse data structure. Multiple deep merges can be achieved
by appending digits to =<<<=. Exmaple:#+begin_src yaml
defaults: &DEFAULTS
hello: world
this:
is:
even: deeperoverrides: &OVERRIDES
this:
is:
even: deeper, i tell youmain:
<<<1: *DEFAULTS
<<<2: *OVERRIDES
this:
is:
somewhat: deep
#+end_srcwill be interpreted as
#+begin_src yaml
defaults:
hello: world
this:
is:
even: deeperoverrides:
this:
is:
even: deeper, i tell youmain:
this:
is:
somewhat: deep
even: deeper, i tell you
hello: world
#+end_src** Development
:PROPERTIES:
:CUSTOM_ID: development
:END:After checking out the repo, run =bin/setup= to install dependencies.
Then, run =rake test= to run the tests. You can also run =bin/console=
for an interactive prompt that will allow you to experiment.To install this gem onto your local machine, run
=bundle exec rake install=. To release a new version, update the version
number in =version.rb=, and then run =bundle exec rake release=, which
will create a git tag for the version, push git commits and tags, and
push the =.gem= file to [[https://rubygems.org][rubygems.org]].** Contributing
:PROPERTIES:
:CUSTOM_ID: contributing
:END:Bug reports and pull requests are welcome on GitHub at
https://github.com/200ok-ch/yaml_extensions. This project is intended to
be a safe, welcoming space for collaboration, and contributors are
expected to adhere to the
[[https://github.com/branch14/yaml_extensions/blob/master/CODE_OF_CONDUCT.md][code of conduct]].** License
:PROPERTIES:
:CUSTOM_ID: license
:END:The gem is available as open source under the terms of the
[[https://opensource.org/licenses/MIT][MIT License]].** Code of Conduct
:PROPERTIES:
:CUSTOM_ID: code-of-conduct
:END:Everyone interacting in the YamlExtensions project's codebases, issue
trackers, chat rooms and mailing lists is expected to follow the
[[https://github.com/200ok-ch/yaml_extensions/blob/master/CODE_OF_CONDUCT.md][code
of conduct]].