class Opal::Prompt::ProgressBar

Overview

Smooth Unicode progress bar with percentage, counters, and in-place redrawing.

Defined in:

opal/prompt/progress.cr

Constant Summary

SUB_BLOCKS = [" ", "▏", "▎", "▍", "▌", "▋", "▊", "▉", "█"]

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(total : Int32, bar_width : Int32 = 30, color : Color | Symbol | String = :cyan, title : String | Nil = nil, driver : Terminal::Driver | Nil = nil) #

[View source]

Class Method Detail

def self.run(total : Int32, bar_width : Int32 = 30, color : Color | Symbol | String = :cyan, title : String | Nil = nil, driver : Terminal::Driver | Nil = nil, &block : ProgressBar -> Nil) : Nil #

Yields an active progress bar and renders updates.


[View source]

Instance Method Detail

def advance(step : Int32 = 1) : Nil #

Increments current value by step and redraws.


[View source]
def bar_width : Int32 #

[View source]
def bar_width=(bar_width : Int32) #

[View source]
def color : Color #

[View source]
def color=(color : Color) #

[View source]
def current : Int32 #

[View source]
def current=(current : Int32) #

[View source]
def finish : Nil #

[View source]
def percent : Float64 #

[View source]
def render : Nil #

Renders the progress bar string to the terminal.


[View source]
def set(val : Int32) : Nil #

Sets current progress value and redraws.


[View source]
def title : String | Nil #

[View source]
def title=(title : String | Nil) #

[View source]
def total : Int32 #

[View source]
def total=(total : Int32) #

[View source]