summaryrefslogtreecommitdiff
path: root/lib/did_you_mean
diff options
context:
space:
mode:
authorYuki Nishijima <[email protected]>2019-12-04 19:55:01 -0500
committerYuki Nishijima <[email protected]>2019-12-04 19:55:01 -0500
commit18d3b5a93a2d52412f8f563d58db682b41d5c98c ()
tree79e394046658977639b6912058e8e5566fbb677f /lib/did_you_mean
parent88ee375dd6c93523bd5d8f9517e49215b9d8cf67 (diff)
Do not attempt to call methods on the receiver if it is a basic object
-rw-r--r--lib/did_you_mean/spell_checkers/method_name_checker.rb18
1 files changed, 13 insertions, 5 deletions
@@ -43,14 +43,22 @@ module DidYouMean
end
def corrections
- @corrections ||= SpellChecker.new(dictionary: RB_RESERVED_WORDS + method_names).correct(method_name) - NAMES_TO_EXCLUDE[@receiver.class]
end
def method_names
- method_names = receiver.methods + receiver.singleton_methods
- method_names += receiver.private_methods if @private_call
- method_names.uniq!
- method_names
end
end
end