class MdSpell::Typo
A wrapper class for single, misspelled word.
Attributes
line[R]
A TextLine
that contains this error.
suggestions[R]
A list of suggestions for this error.
word[R]
A misspelled word.
Public Class Methods
new(line, word, suggestions)
click to toggle source
Create a new SpellingError. @param line [TextLine] the TextLine
that contains the error. @param word [String] the misspelled word. @param suggestions [Array] an array of suggestions for the word.
# File lib/mdspell/typo.rb, line 17 def initialize(line, word, suggestions) assert_proper_line_type(line) assert_proper_word_type(word) assert_proper_suggestions_type(suggestions) @line = line @word = word @suggestions = suggestions end
Private Instance Methods
assert_proper_line_type(line)
click to toggle source
# File lib/mdspell/typo.rb, line 29 def assert_proper_line_type(line) raise ArgumentError, "expected TextLine, got #{line.class.inspect}" unless line.class == TextLine end
assert_proper_suggestions_type(suggestions)
click to toggle source
# File lib/mdspell/typo.rb, line 39 def assert_proper_suggestions_type(suggestions) raise ArgumentError, "expected Array, got #{suggestions.class.inspect}" unless suggestions.class == Array end
assert_proper_word_type(word)
click to toggle source
# File lib/mdspell/typo.rb, line 34 def assert_proper_word_type(word) raise ArgumentError, "expected String, got #{word.class.inspect}" unless word.class == String end