Crab::Bar
Inherits Crab::Renderable / Reference / Object
A class to handle the progress of a task (Only used in progress.cr)
Constructors
new(width : Int32 = 50, text : String = "", total : Int32 = 100, current : Int32 = 0, color : String = "default")
Create a new progress bar The parameters are:
- width: The width of the bar (default: 50)
- text: The text to display before the bar (default: "") (max 15 characters)
- total: The total number of units in the bar (default: 100)
- current: The current number of units in the bar (default: 0)
- color: The color of the bar (default: "default") (can be any color supported by Crab::Ansi_Parser, including r,g,b formats)
Instance methods
color
Sourcecurrent
Sourcerender
Render the Bar to a String to be Parsed by an Crab::Ansi_Parser, if possible do not call directly Prefer to use the Crab::Progress class to handle progress bars
text
Sourcetotal
Sourcewidth
Source