Class: Tuxedo::CaneViolation::UndocumentedClassViolation

Inherits:
Tuxedo::CaneViolation show all
Defined in:
lib/tuxedo/cane_violation/undocumented_class_violation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tuxedo::CaneViolation

#violation_type, #violation_type_snake_cased

Instance Attribute Details

#file_nameObject

Returns the value of attribute file_name.



4
5
6
# File 'lib/tuxedo/cane_violation/undocumented_class_violation.rb', line 4

def file_name
  @file_name
end

#lineObject

Returns the value of attribute line.



4
5
6
# File 'lib/tuxedo/cane_violation/undocumented_class_violation.rb', line 4

def line
  @line
end

#line_numberObject

Returns the value of attribute line_number.



4
5
6
# File 'lib/tuxedo/cane_violation/undocumented_class_violation.rb', line 4

def line_number
  @line_number
end

Class Method Details

.from_cane(cane_violation) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/tuxedo/cane_violation/undocumented_class_violation.rb', line 6

def self.from_cane(cane_violation)
  violation = new

  violation.file_name   = cane_violation.file_name
  violation.line_number = cane_violation.number
  violation.line        = cane_violation.line

  violation
end

Instance Method Details

#class_name(line) ⇒ Object



20
21
22
# File 'lib/tuxedo/cane_violation/undocumented_class_violation.rb', line 20

def class_name(line)
  line.match(/class (\S+)/)[1]
end

#descriptionObject



16
17
18
# File 'lib/tuxedo/cane_violation/undocumented_class_violation.rb', line 16

def description
  "Classes are not documented"
end

#to_hashObject



24
25
26
27
28
29
30
31
32
# File 'lib/tuxedo/cane_violation/undocumented_class_violation.rb', line 24

def to_hash
  {
    :violation_type => violation_type,
    :file_name      => file_name,
    :line_number    => line_number,
    :line           => line,
    :description    => description,
  }
end