Module: Mentor::Colorize

Includes:
OutputHelper
Included in:
Docs, ErrorClassSpecificHelp, Examples, Header, MentorError, MentorNoMethodError, Suggestion, TextToColor
Defined in:
lib/helpers/colorize.rb

Instance Method Summary collapse

Methods included from OutputHelper

#a_an, #and_sentence, #culprit_line, #home_to_tilde, #indent_lines, #lines_from_file, #or_sentence, #pluralize, #pluralize_words, #terminal_width, #valid_var_name

Instance Method Details

#colorize(line) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/helpers/colorize.rb', line 7

def colorize(line)

  if line_of_padded_code?(line)
    line = color_padded_code(line)
  elsif backtrace?(line)
    return rainbow(line, :backtrace_line)
  end

  apply_colors(line)
end

#colorize_sectionObject



18
19
20
# File 'lib/helpers/colorize.rb', line 18

def colorize_section
  @lines.map! { |line| colorize(line) }
end