Class: AlfonsoX::SpellChecker::Word
- Inherits:
-
Object
- Object
- AlfonsoX::SpellChecker::Word
- Defined in:
- lib/alfonsox/spellchecker/word.rb
Overview
Each of the spell-checked words
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#word ⇒ Object
readonly
Returns the value of attribute word.
Instance Method Summary collapse
-
#check ⇒ Boolean
Check if the word is right.
-
#initialize(word, line, dictionaries) ⇒ Word
constructor
Initialize a spell-checked word.
Constructor Details
#initialize(word, line, dictionaries) ⇒ Word
Initialize a spell-checked word.
15 16 17 18 19 20 |
# File 'lib/alfonsox/spellchecker/word.rb', line 15 def initialize(word, line, dictionaries) @word = word @line = line @dictionaries = dictionaries @right = nil end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
8 9 10 |
# File 'lib/alfonsox/spellchecker/word.rb', line 8 def line @line end |
#word ⇒ Object (readonly)
Returns the value of attribute word.
8 9 10 |
# File 'lib/alfonsox/spellchecker/word.rb', line 8 def word @word end |
Instance Method Details
#check ⇒ Boolean
Check if the word is right. Assigns the Word#right attribute.
25 26 27 28 29 30 31 |
# File 'lib/alfonsox/spellchecker/word.rb', line 25 def check @dictionaries.each do |dictionary| @right = check_for_dictionary(dictionary) return true if @right end false end |