Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/markbates/yamler
Tools for using YAML w/ Ruby easier.
https://github.com/markbates/yamler
Last synced: 2 months ago
JSON representation
Tools for using YAML w/ Ruby easier.
- Host: GitHub
- URL: https://github.com/markbates/yamler
- Owner: markbates
- License: mit
- Created: 2009-01-20T22:11:23.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2016-05-24T18:44:15.000Z (over 8 years ago)
- Last Synced: 2024-10-03T16:34:44.938Z (3 months ago)
- Language: Ruby
- Homepage: http://www.mackframework.com
- Size: 102 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
Yamler - Making YAML easy and fun to use with Ruby
=========================================================================Using YAML in Ruby is pretty easy, but I find myself doing several things
every time I use YAML. First is I always seem to pass it through ERB. The
other is that I want to pass it a binding, because I want to give it
access to some variables or methods. Finally I sometimes end up merging
several YAML files into one file, because other wise it would be too big
and unwieldy to manage. Enter Yamler:=== Examples:
# Renders said file through ERB, and then through YAML.load:
Yamler.load('/path/to/file.yml')# Does the same as above but makes a method called say_hi
# available to the binding of the Yamler::Template instance.
Yamler.load('/path/to/file.yml') do
def say_hi
'hi'
end
end
# Renders said file through ERB, and then through YAML.load:
Yamler.load('/path/to/file.yml', {:locals => {:username => 'markbates'}, :foo => :bar})