Crab::Table
Inherits Crab::Renderable / Reference / Object
A class to create a table with a title It can be used to create a table with data inside
Constructors
Create a new table: The arguments are:
- column_names: An array of strings with the names of the columns (mandatory)
- title: A string with the title of the table (optional)
- crab_codes: A string with the crab codes to be used in the table (optional)
- box_crab_codes: A string with the crab codes to be used in the box (optional)
- header_crab_codes: A string with the crab codes to be used in the header/column names (optional)
- style: A string with the style of the table (optional) The styles are:
- default: The default style
- double: The double style
- ascii: The ascii style if otherwise specified, the default style will be used
Instance methods
A method to add a row of data to the table It takes an array of strings and adds it to the table
A method to easily prepare a row of data to be added to the table It takes an array of strings, ints, floats, bools or nil and adds it to the table by calling prepare_row and add_row
A method to prepare a row of data to be only strings It takes an array of strings, ints, floats, bools or nil and returns an array of strings with the data prepared With crab codes For more information see Crab::TypeParser
The render method of the table It takes no arguments and returns a string with the table rendered Will be directly called by an Crab::Ansi_Parser or Crab.puts method If possible do not call directly
A method to somewhat parse the row of data to be printed It takes an array of strings, the crab codes to be used, the vertical character to be used and the width of the table If possible do not call directly