Class: Typocop::Cop

Inherits:
Object
  • Object
show all
Defined in:
lib/typocop/cop.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, line, typos) ⇒ Cop

Returns a new instance of Cop.



5
6
7
8
9
# File 'lib/typocop/cop.rb', line 5

def initialize(path, line, typos)
  @path = path
  @line = line
  @typos = typos
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



3
4
5
# File 'lib/typocop/cop.rb', line 3

def line
  @line
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/typocop/cop.rb', line 3

def path
  @path
end

#typosObject (readonly)

Returns the value of attribute typos.



3
4
5
# File 'lib/typocop/cop.rb', line 3

def typos
  @typos
end

Instance Method Details

#correct_wordsObject



15
16
17
# File 'lib/typocop/cop.rb', line 15

def correct_words
  @typos.map { |typo| typo[:correct_word] }
end

#incorrect_wordsObject



11
12
13
# File 'lib/typocop/cop.rb', line 11

def incorrect_words
  @typos.map { |typo| typo[:incorrect_word] }
end