What is YAML?
YAML is a data format for similar in purpose as XML and JSON. The design emphasize on human-readable. The syntax is similar to python. [see Python 3 Tutorial by Example] YAML use indentation for nesting, and doesn't use any type brackets for nesting. The format is line-based (like unix config files).
YAML file has file extension “.yml”.
Sample YAML file, used by Google App Engine:
application: helloworld version: 1 runtime: python27 api_version: 1 threadsafe: true handlers: - url: /.* script: helloworld.app
Another Sample YAML file from Wikipedia:
--- receipt: Oz-Ware Purchase Invoice date: 2007-08-06 customer: given: Dorothy family: Gale items: - part_no: A4786 descrip: Water Bucket (Filled) price: 1.47 quantity: 4 - part_no: E1628 descrip: High Heeled "Ruby" Slippers size: 8 price: 100.27 quantity: 1 bill-to: &id001 street: | 123 Tornado Alley Suite 16 city: East Centerville state: KS ship-to: *id001 specialDelivery: > Follow the Yellow Brick Road to the Emerald City. Pay no attention to the man behind the curtain. ...
another example, for setting up mongodb.
development: sessions: default: database: xyz_dev hosts: - localhost:27017 production: sessions: default: database: xyz_prod hosts: - localhost:27017 username: <%= ENV['MONGOID_USERNAME'] %> password: <%= ENV['MONGOID_PASSWORD'] %>
Ask me question on patreon