class CLI::UI::Widgets::Status
Constants
- ARGPARSE_PATTERN
- ARROW
- CLOSE
- COMMA
- EMPTY_SET
- OPEN
- SPINNER_STOPPED
Public Instance Methods
render()
click to toggle source
# File lib/cli/ui/widgets/status.rb, line 22 def render if zero?(@succeeded) && zero?(@failed) && zero?(@working) && zero?(@pending) Color::RESET.code + Color::BOLD.code + EMPTY_SET + Color::RESET.code else # [ 0✓ , 2✗ ◂ 3⠼ ◂ 4⌛︎ ] "#{OPEN}#{succeeded_part}#{COMMA}#{failed_part}#{ARROW}#{working_part}#{ARROW}#{pending_part}#{CLOSE}" end end
Private Instance Methods
colorize_if_nonzero(num_str, rune, color)
click to toggle source
# File lib/cli/ui/widgets/status.rb, line 37 def colorize_if_nonzero(num_str, rune, color) color = Color::GRAY if zero?(num_str) color.code + num_str + rune end
failed_part()
click to toggle source
# File lib/cli/ui/widgets/status.rb, line 46 def failed_part colorize_if_nonzero(@failed, Glyph::X.char, Color::RED) end
pending_part()
click to toggle source
# File lib/cli/ui/widgets/status.rb, line 55 def pending_part colorize_if_nonzero(@pending, Glyph::HOURGLASS.char, Color::WHITE) end
succeeded_part()
click to toggle source
# File lib/cli/ui/widgets/status.rb, line 42 def succeeded_part colorize_if_nonzero(@succeeded, Glyph::CHECK.char, Color::GREEN) end
working_part()
click to toggle source
# File lib/cli/ui/widgets/status.rb, line 50 def working_part rune = zero?(@working) ? SPINNER_STOPPED : Spinner.current_rune colorize_if_nonzero(@working, rune, Color::BLUE) end
zero?(num_str)
click to toggle source
# File lib/cli/ui/widgets/status.rb, line 33 def zero?(num_str) num_str == '0' end