[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] yip v0.8

bruce

10/25/2003 7:50:00 AM

All,

I'm announcing the initial release (0.8) of yip, a library which adds
YPATH-based interpolation to whytheluckystiff's YAML implementation,
Syck (which is included with Ruby 1.8).

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

You can find it at the RAA: http://raa.ruby-lang.org/list.rhtm...
or download it directly at http://codedbliss.com/releases/yip-...

From the README:

yip uses YPATHs to find nodes referenced for interpolation. See
http://yaml.freepan.org/index.cgi?Ypath... 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).

--
Bruce Williams - bruce at codedbliss.com