Class: RuboCop::Gradual::Results::Issue
- Inherits:
-
Object
- Object
- RuboCop::Gradual::Results::Issue
- Defined in:
- lib/rubocop/gradual/results/issue.rb
Overview
IssueResults is a representation of an issue in a Gradual results.
Instance Attribute Summary collapse
-
#code_hash ⇒ Object
readonly
Returns the value of attribute code_hash.
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #distance(other) ⇒ Object
-
#initialize(line:, column:, length:, message:, hash:) ⇒ Issue
constructor
A new instance of Issue.
- #to_s ⇒ Object
Constructor Details
#initialize(line:, column:, length:, message:, hash:) ⇒ Issue
Returns a new instance of Issue.
10 11 12 13 14 15 16 |
# File 'lib/rubocop/gradual/results/issue.rb', line 10 def initialize(line:, column:, length:, message:, hash:) @line = line @column = column @length = length @message = @code_hash = hash end |
Instance Attribute Details
#code_hash ⇒ Object (readonly)
Returns the value of attribute code_hash.
8 9 10 |
# File 'lib/rubocop/gradual/results/issue.rb', line 8 def code_hash @code_hash end |
#column ⇒ Object (readonly)
Returns the value of attribute column.
8 9 10 |
# File 'lib/rubocop/gradual/results/issue.rb', line 8 def column @column end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
8 9 10 |
# File 'lib/rubocop/gradual/results/issue.rb', line 8 def length @length end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
8 9 10 |
# File 'lib/rubocop/gradual/results/issue.rb', line 8 def line @line end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
8 9 10 |
# File 'lib/rubocop/gradual/results/issue.rb', line 8 def @message end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 |
# File 'lib/rubocop/gradual/results/issue.rb', line 18 def <=>(other) [line, column, length, ] <=> [other.line, other.column, other.length, other.] end |
#==(other) ⇒ Object
26 27 28 |
# File 'lib/rubocop/gradual/results/issue.rb', line 26 def ==(other) line == other.line && column == other.column && length == other.length && code_hash == other.code_hash end |
#distance(other) ⇒ Object
30 31 32 |
# File 'lib/rubocop/gradual/results/issue.rb', line 30 def distance(other) [(line - other.line).abs, (column - other.column).abs] end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/rubocop/gradual/results/issue.rb', line 22 def to_s "[#{[line, column, length, JSON.dump(), code_hash].join(", ")}]" end |