YAML
The YAML library, available with require "yaml", serializes and deserializes Ruby object trees to and from an external, readable, plain-text format. YAML can be used as a portable object marshaling scheme, allowing objects to be passed in plain text between separate Ruby processes. In some cases, objects may also be exchanged between Ruby programs and programs in other languages that also have YAML support.
The YAML module in Ruby is an alias to Psych, which is the name of the YAML parser being used. We mention this because it may be easier to find further documentation searching for Psych rather than YAML.
Writing YAML
YAML can be used to store an object tree in a string. The API call is YAML.dump(object, io = nil, options = {}). The ...
Get Programming Ruby 3.3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.