Crab::Panel
Inherits Crab::Renderable / Reference / Object
A class to create a panel with a title and text It can be used to create a box with text inside
Constructors
Create a new Panel object It's parameters are: width: The width of the panel, is possible use Crab.get_cols for this length: The length of the panel, it is the number of lines it will have text: The text to be display inside the panel default is "" title: The title of the panel, it will be displayed on top of the panel, default is "" crab_codes: A string with the crab codes to apply to the text inside the panel, default is "", example "#[red]#[blue, bg]" box_crab_codes: A string with the crab codes to apply to the box of the panel, default is "", example "#[red]#[blue, bg]" hpos: A string to set the horizontal position of the text, it can be right, left or center, defaults to center. vpos: A string to set the vertical position of the text, it can be top, bottom or center, defaults to center. style: A string to set the style of the panel, it can be default, double, ascii, defaults to default.
Instance methods
A method to set paragraphs based on the width of the panel it has 1 parameter, text is the text to set as paragraphs it returns a string with the text set as paragraphs separated by newlines Please do not call this method directly
Render the Panel to a String to be Parsed by an Crab::Ansi_Parser, if possible do not call directly
A method to align text based on the width of the panel it has 2 parameters, text is the text to align, is_title is a boolean that tells if the text is a title, if not passed it defaults to false it returns a string with the text aligned Please do not call this method directly