class FlexibleTable

This is the main class for creating Tables. The user can create a series of columns, and the print those columns out. See the README for more example usages.

Examples

table = FlexibleTable.new
table.add_column("I'm the first column", 10)
table.add_column("I'm the second column", 10)
table.print_header
table.print_row("I'll be in column 1", "I'll be in column 2")
table.print_row("I'll be in column 1", "I'll be in column 2")
table.print_row("I'll be in column 1", "I'll be in column 2")

Public Class Methods

new() click to toggle source
# File lib/flexible_table.rb, line 22
def initialize
        @total_screen_columns = IO.console.winsize[1]
        @columns              = []
end

Public Instance Methods

add_column(title, width_percentage, **args) click to toggle source
# File lib/flexible_table.rb, line 27
def add_column(title, width_percentage, **args)
        @columns << FlexibleColumn.new(title, width_percentage, args)
end
print_header(io: $stdout) click to toggle source
print_row(*args, io: $stdout) click to toggle source