-
-
Notifications
You must be signed in to change notification settings - Fork 131
Overriding the Length
bjmfactory edited this page Nov 18, 2014
·
1 revision
By default, the progress bar will try to be as smart as possible about how wide it can be. Under most Unix systems, it should be as wide as the terminal will allow while still fitting on one line. If you wish to override this behavior, you can pass in the :length
option when creating the bar:
ProgressBar.create(:length => 40)
If you don't have access to the code calling the progress bar itself (say if you're using a gem like Fuubar), you can set the RUBY_PROGRESS_BAR_LENGTH
environment variable and it will override any other setting.
Note: If the terminal width is less than 20 characters or ruby-progressbar is being used on a non-*nix system, the bar will default to an 80 character width.