Displaying cli base table at ruby application on terminal

I Simply write it (for note). It is easy to develop using terminal-table.

How to Install?

gem install terminal-table

on Code

You can set the header or size using options of the terminal-table object, and the data can be put into an Array list.

require 'terminal-table'

rows = []
rows << ['xss', 'on']
rows << ['sqli', 'on']
rows << ['code', 'on']

table = Terminal::Table.new
table.title = "Cheatsheet"
table.headings = ['type', 'state']
table.rows = rows
table.style = {:width => 40}

# > puts table
+-------------------+------------------+
|              Cheatsheet              |
+-------------------+------------------+
| type              | state            |
+-------------------+------------------+
| xss               | on               |
| sqli              | on               |
| code              | on               |
+-------------------+------------------+

I applied this to the tool I created.