module AmdgpuFan::CliOutputFormat

A mixin to help with CLI output formatting

Constants

METER_CHAR
TIME_FORMAT

Private Instance Methods

current_time() click to toggle source
# File lib/amdgpu_fan/mixin/cli_output_format.rb, line 11
def current_time
  Time.now.strftime(TIME_FORMAT)
end
percent_meter(percent, length = 10) click to toggle source
# File lib/amdgpu_fan/mixin/cli_output_format.rb, line 15
def percent_meter(percent, length = 10)
  progress_bar_count = (length * percent.to_f / 100).round
  percent_string = "#{format '%<num>0.2i', num: percent}%".ljust(3)
  "[#{METER_CHAR * progress_bar_count}#{' ' * (length - progress_bar_count)}]#{percent_string}"
end