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(lang) ⇒ HTML_Spellchecker
constructor
A new instance of HTML_Spellchecker.
- #spellcheck(html) ⇒ Object
Constructor Details
#initialize(lang) ⇒ HTML_Spellchecker
Returns a new instance of HTML_Spellchecker.
17 18 19 |
# File 'lib/html_spellchecker.rb', line 17 def initialize(lang) @dict = FFI::Hunspell.dict(lang) 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 'en_US' end |
.french ⇒ Object
13 14 15 |
# File 'lib/html_spellchecker.rb', line 13 def self.french @french ||= self.new 'fr_FR' 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 |