Exception: Mentor::NoMethodDidYouMeanSuggestionError

Inherits:
MentorNoMethodError show all
Defined in:
lib/errors/no_method_did_you_mean_suggestion_error.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Colorize

#colorize, #colorize_section

Methods included from Outputs

#absolute_base_dir, #app_dir, #backtrace_lines, #calling_method, #did_you_mean_text, #did_you_mean_word, #error_lineno, #error_lineno_padded, #file_name, #horizontal_line, #instance_methods, #lineno_subtle_padded, #message, #method_class, #method_class_plural, #method_class_superclass, #method_class_superclasses, #method_name, #relative_base_dir, #ruby_error_class, #ruby_error_text, #var_for_method

Methods included from OutputHelper

#home_to_tilde, #indent_lines, #lines_from_file, #terminal_width, #valid_var_name

Methods inherited from MentorError

find, #output

Class Method Details

.can_handle?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/errors/no_method_did_you_mean_suggestion_error.rb', line 5

def self.can_handle?
  super && Mentor.tp.raised_exception&.corrections.any?
end

Instance Method Details

#sectionsObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/errors/no_method_did_you_mean_suggestion_error.rb', line 9

def sections
  [
    Header.new,
    RubyErrorComplete.new,
    RelativePath.new,
    LinesOfCode.new,
    ErrorClassSpecificHelp.new(error_class_specific_help),
    Suggestion.new("Try changing the method #{method_name} to #{did_you_mean_word} on #{var_for_method}.")
  ]
end