[ruby-announce] [ANN] html-table 0.0.3

Daniel Berger <[email protected]> Tue, 08 Jul 2003 14:50:04 -0600
Newsgroups gmane.comp.lang.ruby.announce
Organization Qwest
Message-ID <[email protected]>
Hi all,

I'm happy to announce the release of html-table 0.0.3 (beta).  This is a 
  very different API from what you saw in 0.0.1.

A Table is now a subclass of Array, as are most of its components, which 
means that you can access rows/elements etc by index number if you wish, 
as well as use any of the Array/Enumerable methods for convenience.

In addition, you can now omit end tags (where permitted) as well as 
capitalize your HTML tags, for those that prefer that style.

Here's an example (simple2.rb from the docs/examples directory).  Note 
that there is usually more than one way to accomplish the same output. 
See the docs and examples for more details.

require "html/table"
include HTML

Table.html_case = "upper"
Table::Row.end_tags = false
Table::Row::Data.end_tags = false

table = Table.new
tr1 = Table::Row.new
tr2 = Table::Row.new
tr3 = Table::Row.new

tr1.content = "foo", "bar", "baz"
tr2.content = 1,2,3
tr3.content = %w/hello world/

table.push(tr1,tr2,tr3)

table[0][1].align = "left"

puts table.html

### OUTPUT ###
<TABLE>
    <TR>
       <TD>foo
       <TD ALIGN='LEFT'>bar
       <TD>baz
    <TR>
       <TD>1
       <TD>2
       <TD>3
    <TR>
       <TD>hello
       <TD>world
</TABLE>

Regards,

Dan

PS - 0.0.2 was largely similar, but it's missing the capitalization 
option, plus the tarball was somewhat messed up.  That's why it was 
never announced.