class Mentor::Header

Public Instance Methods

lines() click to toggle source
# File lib/sections/header.rb, line 7
def lines
  @lines = [
    horizontal_line,
    title_indented,
    horizontal_line
  ]

  colorize_section
end

Private Instance Methods

title_bar_spacer_size() click to toggle source
# File lib/sections/header.rb, line 29
def title_bar_spacer_size
  start_of_line = ruby_error_text + ' ' + ruby_error_class
  end_of_line   = file_name + ':' + error_lineno
  terminal_width - (start_of_line.length + end_of_line.length)
end
title_bar_spacer_with_indent() click to toggle source
# File lib/sections/header.rb, line 39
def title_bar_spacer_with_indent
  ' ' * (title_bar_spacer_size - 2)
end
title_bar_spacer_without_indent() click to toggle source
# File lib/sections/header.rb, line 35
def title_bar_spacer_without_indent
  ' ' * title_bar_spacer_size
end
title_indented() click to toggle source
# File lib/sections/header.rb, line 19
def title_indented
  if title_bar_spacer_size > 4
    " #{ruby_error_text} #{ruby_error_class}#{title_bar_spacer_with_indent}#{file_name}:#{error_lineno}"
  elsif title_bar_spacer_size > 2
    "#{ruby_error_text} #{ruby_error_class}#{title_bar_spacer_without_indent}#{file_name}:#{error_lineno}"
  else
    "#{ruby_error_text} #{ruby_error_class}\n#{file_name}:#{error_lineno}"
  end
end