Class: Tuxedo::CaneViolation

Inherits:
Object
  • Object
show all
Defined in:
lib/tuxedo/cane_violation.rb,
lib/tuxedo/cane_violation/style_violation.rb,
lib/tuxedo/cane_violation/syntax_violation.rb,
lib/tuxedo/cane_violation/abc_max_violation.rb,
lib/tuxedo/cane_violation/threshold_violation.rb,
lib/tuxedo/cane_violation/undocumented_class_violation.rb

Defined Under Namespace

Classes: AbcMaxViolation, StyleViolation, SyntaxViolation, ThresholdViolation, UndocumentedClassViolation

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_cane(cane_violation) ⇒ Object



9
10
11
12
13
# File 'lib/tuxedo/cane_violation.rb', line 9

def self.from_cane(cane_violation)
  type  = cane_violation.class.name.split('::').last
  klazz = const_defined?(type) && const_get(type)
  klazz && klazz.from_cane(cane_violation)
end

Instance Method Details

#violation_typeObject



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

def violation_type
  self.class.name.split("::").last
end

#violation_type_snake_casedObject



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

def violation_type_snake_cased
  _underscore(violation_type)
end