class Mentor::MentorError

Public Class Methods

can_handle?() click to toggle source
# File lib/errors/mentor_error.rb, line 11
def self.can_handle?
  Mentor.tp.raised_exception.class == RuntimeError
end
error_classes() click to toggle source
# File lib/errors/mentor_error.rb, line 23
def self.error_classes
  [
    NoMethodDidYouMeanStringLiteralError,
    NoMethodDidYouMeanNumericLiteralError,
    NoMethodDidYouMeanSuggestionError,
    NoMethodForNilClassForCommonClassError,
    NoMethodForNilClassError,
    MentorNoMethodError,
    MentorError
  ]
end
find() click to toggle source
# File lib/errors/mentor_error.rb, line 7
def self.find
  error_classes.find(&:can_handle?)
end

Public Instance Methods

output() click to toggle source
# File lib/errors/mentor_error.rb, line 15
def output
  puts
  sections_formatted.each do |section|
    puts section
    puts
  end
end

Private Instance Methods

sections() click to toggle source
# File lib/errors/mentor_error.rb, line 37
def sections
  [
    Header.new,
    RubyErrorComplete.new,
    RelativePath.new,
    LinesOfCode.new
  ]
end
sections_formatted() click to toggle source
# File lib/errors/mentor_error.rb, line 46
def sections_formatted
  sections.map do |section|
    section.lines.map do |line|
      colorize line
    end
  end
end