class Gemfilelint::SpellChecker

Attributes

detector[R]
haystack[R]

Public Class Methods

new(haystack) click to toggle source
# File lib/gemfilelint.rb, line 15
def initialize(haystack)
  @detector = Bundler::SimilarityDetector.new(haystack)
  @haystack = haystack
end

Public Instance Methods

correct(needle) click to toggle source
# File lib/gemfilelint.rb, line 20
def correct(needle)
  return [] if haystack.include?(needle)

  detector.similar_words(needle, 2)
end