Class: Tuxedo::CaneViolation::StyleViolation
- Inherits:
-
Tuxedo::CaneViolation
- Object
- Tuxedo::CaneViolation
- Tuxedo::CaneViolation::StyleViolation
- Defined in:
- lib/tuxedo/cane_violation/style_violation.rb
Instance Attribute Summary collapse
-
#char_count ⇒ Object
Returns the value of attribute char_count.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#max_char_count ⇒ Object
Returns the value of attribute max_char_count.
-
#message ⇒ Object
Returns the value of attribute message.
-
#style_violation_type ⇒ Object
Returns the value of attribute style_violation_type.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Tuxedo::CaneViolation
#violation_type, #violation_type_snake_cased
Instance Attribute Details
#char_count ⇒ Object
Returns the value of attribute char_count.
5 6 7 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 5 def char_count @char_count end |
#file_name ⇒ Object
Returns the value of attribute file_name.
4 5 6 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 4 def file_name @file_name end |
#line_number ⇒ Object
Returns the value of attribute line_number.
4 5 6 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 4 def line_number @line_number end |
#max_char_count ⇒ Object
Returns the value of attribute max_char_count.
5 6 7 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 5 def max_char_count @max_char_count end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 4 def @message end |
#style_violation_type ⇒ Object
Returns the value of attribute style_violation_type.
5 6 7 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 5 def style_violation_type @style_violation_type end |
Class Method Details
.from_cane(cane_violation) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 7 def self.from_cane(cane_violation) violation = new violation.file_name = cane_violation.file_name violation.line_number = cane_violation.line violation. = cane_violation. if cane_violation..match /Line is >(\d+) characters \((\d+)\)/ violation.style_violation_type = "LineTooLong" violation.max_char_count = $1.to_i violation.char_count = $2.to_i end violation end |
Instance Method Details
#description ⇒ Object
23 24 25 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 23 def description "Lines violated style requirements" end |
#to_hash ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/tuxedo/cane_violation/style_violation.rb', line 27 def to_hash { :violation_type => violation_type, :file_name => file_name, :line => line, :style_violation_type => style_violation_type, :max_char_count => max_char_count, :char_count => char_count, :description => description, } end |