RAA - text-reform

text-reform / 0.2

Short description: Text-Reform formats your Text !
Category: Library/Text
Status: stable
Created: 2005-01-20 08:43:57 GMT
Last update: 2005-01-20 08:43:57 GMT
Owner: kaspar (Projects of this owner)
Homepage: http://rubyforge.org/projects/text-format/
Download: http://rubyforge.org/frs/?group_id=294
License: Ruby's
Dependency:
Requires: text-hyphen/1.0.0 Hyphenation of Text
Description:
Reform#format takes a series of format (or "picture") strings followed
by replacement values, interpolates those values into each picture
string, and returns the result. 

In examples: 
  # numbers...
  r.format("]]]].[[", "1234\n123")      

    #> 1234.0 
    #> 123.0 

  # strings...
  r.format("[[[[[[[[[[[[[[", "The Newton-Raphson methodology")

    #> The Newton-Ra-
    #> phson methodo-
    #> logy          

  # and combinations:
  text = "A big long piece of text to be formatted exquisitely"
  count = 1
  output = ''
  output << r.format("       ||||  <<<<<<<<<<   ", count, text)
  output << r.format("       ----------------   ",
                     "       ^^^^  ]]]]]]]]]]|  ", count+11, text)
  
    #>        1    A big long
    #>       ----------------
    #>        12     piece of|
    #>             text to be|
    #>              formatted|
    #>             exquisite-|
    #>                     ly|

Edit this project (for project owner)

back to RAA top