Class: SpellCheck::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/spellcheck/filter.rb

Constant Summary collapse

TYPO_PATTERN_LIST =
{}

Class Method Summary collapse

Class Method Details

.spellcheck(word) ⇒ Hash

Returns check result.

Parameters:

  • string (String)

    to be checked.

Returns:

  • (Hash)

    check result.



11
12
13
14
15
16
17
18
19
# File 'lib/spellcheck/filter.rb', line 11

def self.spellcheck(word)
  expected = TYPO_PATTERN_LIST[word.downcase]

  if expected
    { correct: false, pattern: word, expected: expected }
  else
    { correct: true, pattern: word, expected: '' }
  end
end