Skip to content

Options

bjmfactory edited this page Nov 18, 2014 · 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:

  • :title - (Defaults to Progress) - The title of the progress bar.
  • :total - (Defaults to 100) The total number of the items that can be completed.
  • :starting_at - (Defaults to 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 - (Defaults to =) The mark which indicates the amount of progress that has been made.
  • :remainder_mark - (Defaults to ) The mark which indicates the remaining amount of progress to be made.
  • :format - (Defaults to %t: |%B|) The format string which determines how the bar is displayed. See Formatting below.
  • :length - (Defaults to full width if possible, otherwise 80) The preferred width of the entire progress bar including any format options.
  • :output - (Defaults to STDOUT) All output will be sent to this object. Can be any object which responds to .print .flush .tty? .puts.
  • :smoothing - (Defaults to 0.1) See Smoothing Out Estimated Time Jitters below.
  • :throttle_rate - (Defaults to 0.01) See Throttling below.
  • :unknown_progress_animation_steps - (Defaults to ['=---', '-=--', '--=-', '---=']) See Unknown Progress The graphical elements used to cycle when progress is changed but the total amount of items being processed is unknown.
Clone this wiki locally