class Mentor::NoMethodForNilClassError
Public Class Methods
can_handle?()
click to toggle source
Calls superclass method
Mentor::MentorNoMethodError::can_handle?
# File lib/errors/no_method_for_nil_class_error.rb, line 5 def self.can_handle? super && Mentor.tp.raised_exception.to_s['NilClass'] end
Public Instance Methods
sections()
click to toggle source
# File lib/errors/no_method_for_nil_class_error.rb, line 9 def sections [ Header.new, RubyErrorComplete.new, RelativePath.new, LinesOfCode.new, ErrorClassSpecificHelp.new([error_class_specific_help]), Suggestion.new("Try setting #{var_for_method} to a value first and then call the method #{method_name} on it.") ] end
Private Instance Methods
error_class_specific_help()
click to toggle source
# File lib/errors/no_method_for_nil_class_error.rb, line 22 def error_class_specific_help [ "It looks like you're trying to call the method #{method_name} on #{var_for_method}.", '', "It's likely #{var_for_method} was never defined, and therefore is equal to nil, which is how Ruby represents 'nothing'." ] end