Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Zarthus/rtables

Repository files navigation

Ruby Tables

Build Status Code Climate Test Coverage

RTables (Ruby Tables) is a small library that helps you generate table output in various predefined formats.

Installation

To install RTables, you can either git clone the GitHub repository, or simply run gem install rtables

Example Code

require 'rtables'

# Initialize the table you wish to use.
table = RTables::Table::PlainTable.new

# Add the table headers to the table. This will structure our table.
table.add_column('Example')
table.add_column('Second Column')

# Start adding rows to the table.
# For each column you have added, you need to pass another parameter.
table.add_row('Hello', 'World!')
table.add_row('Another day', 'Another row!')
table.add_row('It\'s a beautiful day to be a table', 'Indeed.')

# The final step, we either .render or .to_s our table.
#  .render returns a line-separated array,
#  .to_s calls render.join("\n").
puts table.to_s

Picking the right table format

Tables are nice, but each table has their positive and negative things.

The documentation explains the cons and pros of each table.

Support

There are two primary means of support.

To allow us to help you, we suggest you seek out the documentation and contributing files first.

License

RTables is licensed under the MIT license