bar-of-progress
Everyone knows that progress bars are one of the hard, unsolved problems of computer science, so I decided to give it a shot.
API
Default progress bars
require 'bar-of-progress'
= BarOfProgress.new #=> defaults to completeness == "100"
.progress #=> "[◌◌◌◌◌◌◌◌◌◌]"
.progress(50) #=> "[●●●●●◌◌◌◌◌]"
.progress(49) #=> "[●●●●◍◌◌◌◌◌]"
Custom progress bars
require 'bar-of-progress'
= BarOfProgress.new(
:total => 115.5, #=> default (will be converted to BigDecimal): 100
:length => 14, #=> default (will be converted to Fixnum): 10
:braces => %w{( )}, #=> default: ["[", "]"]
:complete_indicator => "■", #=> default: "●"
:partial_indicator => "▤", #=> default: "◍"
:incomplete_indicator => "□", #=> default: "◌"
:precision => 18 #=> default (determines what is considered 'partial'): 20
)
.progress(30) #=> "(■■■▤□□□□□□□□□□)"