Class: Policial::Violation
- Inherits:
-
Object
- Object
- Policial::Violation
- Defined in:
- lib/policial/violation.rb
Overview
Public: Hold file, line, and message. Built by style guides.
Instance Attribute Summary collapse
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#linter ⇒ Object
readonly
Returns the value of attribute linter.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(file, line_number, message, linter) ⇒ Violation
constructor
A new instance of Violation.
- #line ⇒ Object
- #on_changed_line? ⇒ Boolean
- #patch_position ⇒ Object
Constructor Details
#initialize(file, line_number, message, linter) ⇒ Violation
Returns a new instance of Violation.
8 9 10 11 12 13 |
# File 'lib/policial/violation.rb', line 8 def initialize(file, line_number, , linter) @file = file @line_number = line_number @message = @linter = linter end |
Instance Attribute Details
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
6 7 8 |
# File 'lib/policial/violation.rb', line 6 def line_number @line_number end |
#linter ⇒ Object (readonly)
Returns the value of attribute linter.
6 7 8 |
# File 'lib/policial/violation.rb', line 6 def linter @linter end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
6 7 8 |
# File 'lib/policial/violation.rb', line 6 def @message end |
Instance Method Details
#filename ⇒ Object
15 16 17 |
# File 'lib/policial/violation.rb', line 15 def filename @file.filename end |
#line ⇒ Object
19 20 21 |
# File 'lib/policial/violation.rb', line 19 def line @line ||= @file.line_at(line_number) end |
#on_changed_line? ⇒ Boolean
27 28 29 |
# File 'lib/policial/violation.rb', line 27 def on_changed_line? line.changed? end |
#patch_position ⇒ Object
23 24 25 |
# File 'lib/policial/violation.rb', line 23 def patch_position line.patch_position end |