SixArm.com » Ruby »
HTML utility methods to generate lists, tables, etc.

Introduction

HTML utility methods to generate well-formed HTML for tables, lists, etc.

This is typically to render Ruby objects, such as arrays, as HTML output.

For docs go to http://sixarm.com/sixarm_ruby_html/doc

Want to help? We're happy to get pull requests.

Quickstart

Install:

gem install sixarm_ruby_html

Bundler:

gem "sixarm_ruby_html", "=1.2.0"

Require:

require "sixarm_ruby_html"

Install with high security (optional)

To enable high security for all our gems:

wget http://sixarm.com/sixarm.pem
gem cert --add sixarm.pem
gem sources --add http://sixarm.com

To install with high security:

gem install sixarm_ruby_html --test --trust-policy HighSecurity

Table Methods

Table Examples

headers = ['a','b','c']
footers = ['x','y','z']
rows=[['d','e,'f']]
table(:id=>'foo', :class=>'bar', :headers=>headers, :footers=>footers, :rows=>rows)
=>
<table id="foo" class="bar">
<thead>
<tr>
<th>a</th>
<th>b</th>
<th>c</th>
</tr>
</thead>
<tbody>
<tr>
<td>d</td>
<td>e</td>
<td>f</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>x</th>
<th>y</th>
<th>z</th>
</tr>
</tfoot>
</table>

List Methods

List Examples

ul(['a','b','c']) =>
<ul><li>a</li><li>b</li><li>c</li></ul>

uls(['a','b','c'],['d','e','f'],[1,2,3]) =>
<ul><li>a</li><li>b</li><li>c</li></ul><ul><li>d</li><li>e</li><li>f</li></ul><ul><li>1</li><li>2</li><li>3</li></ul>

Misc Methods

Misc Examples

comment('the following comes from') =>
<!-- the following comes from -->

wrap('foo', 'bar') =>
<bar>foo</bar>

Changes

License

You may choose any of these open source licenses:

The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement.

In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.

This license is for the included software that is created by SixArm; some of the included software may have its own licenses, copyrights, authors, etc. and these do take precedence over the SixArm license.

Copyright (c) 2005-2012 Joel Parker Henderson