Sunday, March 11, 2007

YAML used in Rails

YAML provides you with a way to store Ruby objects, including nested data structures, as text strings—and to thaw those strings back into life as Ruby objects.

Use the command to converts YAML string to Ruby object, and then prints out a representation of that object (with p):
$ ruby -ryaml -e 'p YAML.load(File.read("database.yml"))'
Rails is storing its configuration data as potential Ruby data, easily brought to life with a YAML operation.

Rails uses YAML in several contexts, such as database.yml.

No comments: