0.0
No release in over a year
DLS for working with HTML tables. Easy creation and population of tables in Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 0.10.1
~> 0.14.2
~> 3.12
~> 2.23.2
~> 0.22.0
 Project Readme

HTML-table DSL

DLS for working with HTML tables. Easy creation and population of tables in Ruby.

Install gem

gem install html_table_dsl

Use gem

require 'html/table'

Create table

html_table = Html.table(1, 2, name: 'table_name', class: 'table_class')
# <table name='table_name' class='table_class'><tbody><tr><td></td><td></td></tr></tbody></table>

Change attributes

html_table.attributes = { class: 'table_class_new', name: nil, style: 'border: 1px' }
# <table class='table_class_new' style='border: 1px'> ... </table>

Set headers

head_cols = [Html::HeadCol.new('Text')]
head_rows = [Html::Row.new(head_cols, name: 'row_name', class: 'row_class')]
html_table.write_header(head_rows)
# <table><thead><tr name='row_name' class='row_class'><th>Text</th></tr></thead><tbody> ... </tbody></table>

Set rows

cols = [Html::Col.new('Text', name: 'col_name', style: 'col_style')]
html_table.write_row(0, Html::Row.new(cols, name: 'row_name', class: 'row_class'))
# <table><tbody><tr name='row_name' class='row_class'><td name='col_name' style='col_style'>Text</td></tr></tbody></table>