INSTALLATION

sudo ruby install.rb

LICENSE

© 2003-2004 Bruce Williams <[email protected]>

Free software; modify and redistribute it under the same terms as Ruby itself

ABOUT

yip is a library which adds interpolation to whytheluckystiff’s (whytheluckystiff.net) YAML implementation, Syck (included with Ruby 1.8).

This library is designed primarily for use in configuration files, but may be useful elsewhere.

HOW TO USE IT

yip uses YPATHs to find nodes referenced for interpolation. See yaml.freepan.org/index.cgi?YpathBrainstorm for more information on YPATH.

Here’s a small example:


author: Bruce Williams message: %author% wrote this.

> { ‘author’ => ‘Bruce Williams’, ‘message’ => ‘Bruce Williams

wrote this.‘ }

Simple interpolation is done using %YPATH% notation, as is done above. You can also use a sprintf variant:

---
author: Bruce Williams
version: 0.8
message: >
  %author% says, "Here's the version with two extra zeros %(version)1.3f"

The sprintf notation is the standard notation %1.3f, but the YPATH is included in parenthesis after the ‘%’. This may look eerily familiar to people with Python experience.

Note: In the event a YPATH resolves to a complex datatype, the data is interpolated as YAML (without the document separator).

Take a look at the examples/ subdirectory for additional examples.

TODO

YAML::INTERPOLATION_PATTERN

I'd like to spruce up the sprintf-matching part of the Regexp
before releasing v1.0; at the moment it's a hack.