Class: TinymceSpellcheck::Engines::Raspell

Inherits:
Object
  • Object
show all
Defined in:
lib/tinymce_spellcheck/engines/raspell.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Raspell

Returns a new instance of Raspell.



6
7
# File 'lib/tinymce_spellcheck/engines/raspell.rb', line 6

def initialize(options = {})
end

Instance Method Details

#check_words(lang, words) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/tinymce_spellcheck/engines/raspell.rb', line 9

def check_words(lang, words)
  @speller = Aspell.new(lang)
  @speller.suggestion_mode = Aspell::NORMAL

  misspelled = []
  words.each do |word|
    misspelled << word unless @speller.check(word)
  end
  misspelled
end

#get_suggestions(lang, word) ⇒ Object



20
21
22
23
24
# File 'lib/tinymce_spellcheck/engines/raspell.rb', line 20

def get_suggestions(lang, word)
  @speller = Aspell.new(lang)
  @speller.suggestion_mode = Aspell::NORMAL
  @speller.suggest(word)
end