Class: HTML_Spellchecker
- Inherits:
-
Object
- Object
- HTML_Spellchecker
- Defined in:
- lib/html_spellchecker.rb
Class Attribute Summary collapse
-
.spellcheckable_tags ⇒ Object
Returns the value of attribute spellcheckable_tags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(aff, dic) ⇒ HTML_Spellchecker
constructor
A new instance of HTML_Spellchecker.
- #spellcheck(html) ⇒ Object
Constructor Details
#initialize(aff, dic) ⇒ HTML_Spellchecker
Returns a new instance of HTML_Spellchecker.
17 18 19 |
# File 'lib/html_spellchecker.rb', line 17 def initialize(aff, dic) @dict = Hunspell.new(aff, dic) end |
Class Attribute Details
.spellcheckable_tags ⇒ Object
Returns the value of attribute spellcheckable_tags.
26 27 28 |
# File 'lib/html_spellchecker.rb', line 26 def @spellcheckable_tags end |
Class Method Details
.english ⇒ Object
9 10 11 |
# File 'lib/html_spellchecker.rb', line 9 def self.english @english ||= self.new("/usr/share/hunspell/en_US.aff", "/usr/share/hunspell/en_US.dic") end |
.french ⇒ Object
13 14 15 |
# File 'lib/html_spellchecker.rb', line 13 def self.french @french ||= self.new("/usr/share/hunspell/fr_FR.aff", "/usr/share/hunspell/fr_FR.dic") end |
Instance Method Details
#spellcheck(html) ⇒ Object
21 22 23 |
# File 'lib/html_spellchecker.rb', line 21 def spellcheck(html) Nokogiri::HTML::DocumentFragment.parse(html).spellcheck(@dict) end |