Module: Dex::UI::Progress

Defined in:
lib/dex/ui/progress.rb

Constant Summary collapse

FILLED_BAR =
Dex::UI::Glyph.new("", 0x2588,  Color::CYAN)
UNFILLED_BAR =
Dex::UI::Glyph.new("", 0x2588,  Color::WHITE)

Class Method Summary collapse

Class Method Details

.progress(percent, width) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/dex/ui/progress.rb', line 9

def self.progress(percent, width)
  filled = (percent * width).ceil
  unfilled = width - filled
  Dex::UI.resolve_text [
    (FILLED_BAR.to_s * filled),
    (UNFILLED_BAR.to_s * unfilled)
  ].join
end