class Pretty::Bar
- Pretty::Bar
- Reference
- Object
Overview
Pretty::Bar
builds Ascii-art bar string for the #val
and #max
bar = Pretty::Bar.new(val: 43, max: 176, width: 30)
bar.val # => 43
bar.val_s # => " 43/176"
bar.max # => 176
bar.width # => 30
bar.mark # => "|"
bar.empty # => " "
bar.bar # => "||||||| "
bar.pct # => 24
bar.pct_s # => " 24%"
bar.to_s # => "[||||||| ] 43/176 ( 24%)"
Defined in:
pretty/bar.crConstructors
Instance Method Summary
-
#bar
=> "||||||| "
- #empty : String
- #mark : String
- #max : Int32
-
#pct : Int32
=> 24
-
#pct_s : String
=> " 24%"
-
#to_s(io : IO)
=> "[||||||| ] 43/176 (24%)"
- #val : Int32
-
#val_s : String
=> " 43/176"
- #width : Int32
Constructor Detail
def self.new(val : Int32, max : Int32, width : Int32 = 68, mark : String = "|", empty : String = " ")
#