Exception: Mentor::NoMethodForNilClassForCommonClassError
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Colorize
#colorize, #colorize_section
#a_an, #and_sentence, #culprit_line, #home_to_tilde, #indent_lines, #lines_from_file, #or_sentence, #pluralize, #pluralize_words, #terminal_width, #valid_var_name
Methods inherited from MentorError
error_classes, find, #output
Class Method Details
.can_handle? ⇒ Boolean
5
6
7
8
9
|
# File 'lib/errors/no_method_for_nil_class_for_common_class_error.rb', line 5
def self.can_handle?
super &&
Mentor.tp.raised_exception.to_s['NilClass'] &&
common_methods.include?(method_name.to_sym)
end
|
Instance Method Details
#sections ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/errors/no_method_for_nil_class_for_common_class_error.rb', line 11
def sections
[
.new,
RubyErrorComplete.new,
RelativePath.new,
LinesOfCode.new,
ErrorClassSpecificHelp.new(error_class_specific_help),
Examples.new(examples),
Docs.new(docs),
Suggestion.new("Try setting #{var_for_method} to #{a_an(common_classes_for_error.keys.first)} #{or_sentence(common_classes_for_error.keys)} first and then call the method #{method_name} on it.")
]
end
|