Class: Spelly
- Inherits:
-
Object
- Object
- Spelly
- Defined in:
- lib/spelly.rb,
lib/spelly/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Instance Attribute Summary collapse
-
#dict ⇒ Object
Returns the value of attribute dict.
Instance Method Summary collapse
-
#initialize(language) ⇒ Spelly
constructor
A new instance of Spelly.
- #spell_check(words) ⇒ Object
Constructor Details
#initialize(language) ⇒ Spelly
Returns a new instance of Spelly.
5 6 7 8 |
# File 'lib/spelly.rb', line 5 def initialize language path = "#{Gem.loaded_specs['spelly'].full_gem_path}/lib/dict" @dict = Hunspell.new(path, language) end |
Instance Attribute Details
#dict ⇒ Object
Returns the value of attribute dict.
3 4 5 |
# File 'lib/spelly.rb', line 3 def dict @dict end |
Instance Method Details
#spell_check(words) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/spelly.rb', line 10 def spell_check words results = [] words.each do |word| unless @dict.check?(word) results << {word: word, suggest: @dict.suggest(word)} end end results end |