Module: AttributeStats::Terminal

Included in:
SetAttributeStats, SetDormantTables
Defined in:
lib/stats_generation/terminal.rb

Constant Summary collapse

START_OF_NEXT_LINE =
"\e[1E"
LINE_ABOVE =
"\e[1A"
CLEAR_LINE_TO_RIGHT =
"\e[K"
RED =
"\e[31m"
GREEN =
"\e[32m"
RESET_COLOR =
"\e[0m"

Instance Method Summary collapse

Instance Method Details

#erase_lineObject



10
11
12
# 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) ⇒ Object



25
26
27
# File 'lib/stats_generation/terminal.rb', line 25

def green(text)
  print GREEN, text, RESET_COLOR
end

#in_color(text, index = 0) ⇒ Object



16
17
18
19
# 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) ⇒ Object



21
22
23
# File 'lib/stats_generation/terminal.rb', line 21

def red(text)
  print RED, text, RESET_COLOR
end