Skip to content

Options

Jeff Felchner edited this page Mar 4, 2023 · 6 revisions

If you would like to customize your prompt, you can pass options when you call .create.

ProgressBar.create(:title => "Items", :starting_at => 20, :total => 200)

This will output:

Items: |=======                                                                |

The following are the list of options you can use:

Option Default Description
:title Progress The title of the progress bar.
:total 100 The total number of the items that can be completed.
:starting_at 0 The number of items that should be considered completed when the bar first starts. This is also the default number that the bar will be set to if #reset is called.
:progress_mark = The mark which indicates the amount of progress that has been made.
:remainder_mark empty space The mark which indicates the remaining amount of progress to be made.
:format %t: |%B| The format string which determines how the bar is displayed. See Formatting.
:length full width if possible, otherwise 80 The preferred width of the entire progress bar including any format options.
:output $stdout All output will be sent to this object. Can be any object which responds to .print .flush .tty? .puts.
:projector {} See Projections.
:throttle_rate 0.01 See Throttling.
:unknown_progress_animation_steps ['=---', '-=--', '--=-', '---='] The graphical elements used to cycle when progress is changed but the total amount of items being processed is unknown.

See Unknown Progress