module AttributeStats::Terminal

Constants

CLEAR_LINE_TO_RIGHT
GREEN
LINE_ABOVE
RED
RESET_COLOR
START_OF_NEXT_LINE

en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences

Public Instance Methods

erase_line() click to toggle source
# File lib/stats_generation/terminal.rb, line 10
def erase_line
  print START_OF_NEXT_LINE, LINE_ABOVE, CLEAR_LINE_TO_RIGHT
end
green(text) click to toggle source
# File lib/stats_generation/terminal.rb, line 25
def green(text)
  print GREEN, text, RESET_COLOR
end
in_color(text, index=0) click to toggle source
# File lib/stats_generation/terminal.rb, line 16
def in_color(text, index=0)
  code = (31..37).to_a[index % 7]
  "\e[#{code}m#{text}#{RESET_COLOR}"
end
red(text) click to toggle source
# File lib/stats_generation/terminal.rb, line 21
def red(text)
  print RED, text, RESET_COLOR
end