Class: WordFinder::Checker

Inherits:
FFI::Aspell::Speller
  • Object
show all
Defined in:
lib/word_finder/checker.rb

Overview

Caching subclass of Aspell.

Instance Method Summary collapse

Constructor Details

#initializeChecker

Returns a new instance of Checker.



14
15
16
17
# File 'lib/word_finder/checker.rb', line 14

def initialize(*)
  super
  @cache = {}
end

Instance Method Details

#word?(str) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/word_finder/checker.rb', line 19

def word?(str)
  @cache[str] = correct?(str) unless @cache.key?(str)
  @cache[str]
end