Class: MdSpell::Typo

Inherits:
Object
  • Object
show all
Defined in:
lib/mdspell/typo.rb

Overview

A wrapper class for single, misspelled word.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line, word, suggestions) ⇒ Typo

Create a new SpellingError.

Parameters:

  • line (TextLine)

    the TextLine that contains the error.

  • word (String)

    the misspelled word.

  • suggestions (Array)

    an array of suggestions for the word.



17
18
19
20
21
22
23
24
25
# 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

Instance Attribute Details

#lineObject (readonly)

A TextLine that contains this error.



5
6
7
# File 'lib/mdspell/typo.rb', line 5

def line
  @line
end

#suggestionsObject (readonly)

A list of suggestions for this error.



11
12
13
# File 'lib/mdspell/typo.rb', line 11

def suggestions
  @suggestions
end

#wordObject (readonly)

A misspelled word.



8
9
10
# File 'lib/mdspell/typo.rb', line 8

def word
  @word
end