Class: Rubocop::Cop::Offence
- Inherits:
-
Object
- Object
- Rubocop::Cop::Offence
- Defined in:
- lib/rubocop/cop/offence.rb
Constant Summary collapse
- SEVERITIES =
[:refactor, :convention, :warning, :error, :fatal]
Instance Attribute Summary collapse
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#message ⇒ Object
Returns the value of attribute message.
-
#severity ⇒ Object
Returns the value of attribute severity.
Instance Method Summary collapse
- #encode_severity ⇒ Object
-
#initialize(severity, line_number, message) ⇒ Offence
constructor
A new instance of Offence.
- #to_s ⇒ Object
Constructor Details
#initialize(severity, line_number, message) ⇒ Offence
Returns a new instance of Offence.
10 11 12 13 14 |
# File 'lib/rubocop/cop/offence.rb', line 10 def initialize(severity, line_number, ) @severity = severity @line_number = line_number @message = end |
Instance Attribute Details
#line_number ⇒ Object
Returns the value of attribute line_number.
6 7 8 |
# File 'lib/rubocop/cop/offence.rb', line 6 def line_number @line_number end |
#message ⇒ Object
Returns the value of attribute message.
6 7 8 |
# File 'lib/rubocop/cop/offence.rb', line 6 def @message end |
#severity ⇒ Object
Returns the value of attribute severity.
6 7 8 |
# File 'lib/rubocop/cop/offence.rb', line 6 def severity @severity end |
Instance Method Details
#encode_severity ⇒ Object
20 21 22 |
# File 'lib/rubocop/cop/offence.rb', line 20 def encode_severity @severity.to_s[0].upcase end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/rubocop/cop/offence.rb', line 16 def to_s "#{encode_severity}:%3d: #{}" % [line_number] end |