class DidYouMean::MethodNameChecker
Constants
- NAMES_TO_EXCLUDE
Attributes
method_name[R]
receiver[R]
Public Class Methods
new(exception)
click to toggle source
# File lib/did_you_mean/spell_checkers/method_name_checker.rb, line 10 def initialize(exception) @method_name = exception.name @receiver = exception.receiver @private_call = exception.respond_to?(:private_call?) ? exception.private_call? : false end
Public Instance Methods
corrections()
click to toggle source
# File lib/did_you_mean/spell_checkers/method_name_checker.rb, line 16 def corrections @corrections ||= SpellChecker.new(dictionary: method_names).correct(method_name) - NAMES_TO_EXCLUDE[@receiver.class] end
method_names()
click to toggle source
# File lib/did_you_mean/spell_checkers/method_name_checker.rb, line 20 def method_names method_names = receiver.methods + receiver.singleton_methods method_names += receiver.private_methods if @private_call method_names.uniq! method_names end