class Mentor::NoMethodDidYouMeanSuggestionError

Public Class Methods

can_handle?() click to toggle source
# File lib/errors/no_method_did_you_mean_suggestion_error.rb, line 5
def self.can_handle?
  super &&
    Mentor.tp.raised_exception.respond_to?(:corrections) &&
    Mentor.tp.raised_exception.corrections.any?
end

Public Instance Methods

sections() click to toggle source
# File lib/errors/no_method_did_you_mean_suggestion_error.rb, line 11
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

Private Instance Methods

error_class_specific_help() click to toggle source
# File lib/errors/no_method_did_you_mean_suggestion_error.rb, line 24
def error_class_specific_help
  [
    "#{var_for_method} does not have the method #{method_name}.",
    '',
    'You may have made a typo.'
  ]
end