RubyGems Navigation menu

jig 0.1.2

A jig is an ordered sequence of objects (usually strings) and named _gaps_. When rendered as a string by Jig#to_s, the objects are rendered calling #to_s on each object in order. The gaps are skipped. A new jig may be constructed from an existing jig by 'plugging' one or more of the named gaps. The new jig shares the objects and their ordering from the original jig but with the named gap replaced with the 'plug'. Gaps may be plugged by any object or sequence of objects. When a gap is plugged with another jig, the contents (including gaps) are incorporated into the new jig. Several subclasses (Jig::XML, Jig::XHTML, Jig::CSS) are defined to help in the construction of XML, XHTML, and CSS documents. This is a jig with a single gap named :alpha. Jig.new(:alpha) # => <#Jig: [:alpha]> This is a jig with two objects, 'before' and 'after' separated by a gap named :middle. j = Jig.new('before', :middle, 'after) # => #<Jig: ["before", :middle, "after"]> The plug operation derives a new jig from the old jig. j.plug(:middle, ", during, and") # => #<Jig: ["before", ", during, and ", "after"]> This operation doesn't change j. It can be used again: j.plug(:middle, " and ") # => #<Jig: ["before", " and ", "after"]> There is a destructive version of plug that modifies the jig in place: j.plug!(:middle, "filled") # => #<Jig: ["before", "filled", "after"]> j # => #<Jig: ["before", "filled", "after"]> There are a number of ways to construct a Jig and many of them insert an implicit gap into the Jig. This gap is identified as :___ and is used as the default gap for plug operations when one isn't provided:

Gemfile:
= Copy to clipboard Copied!

install:
=

Versions:

  1. 0.1.2 - February 28, 2008* (32 KB)
  2. 0.1.0 - May 17, 2007* (30 KB)

Runtime Dependencies (1):

hoe >= 1.4.0

Owners:

Authors:

  • Gary R. Wright

SHA 256 checksum:

d8b0b2f05348e3840857fa02e221a51e8d12a2c91e7c3804cd66b3c346d96337

Total downloads 8,377

For this version 4,751

Licenses:

N/A

Required Ruby Version: > 0.0.0

Links: