Class: RuboCop::Gradual::Results::File
- Inherits:
-
Object
- Object
- RuboCop::Gradual::Results::File
- Defined in:
- lib/rubocop/gradual/results/file.rb
Overview
File is a representation of a file in a Gradual results.
Instance Attribute Summary collapse
-
#file_hash ⇒ Object
readonly
Returns the value of attribute file_hash.
-
#issues ⇒ Object
readonly
Returns the value of attribute issues.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #changed_issues(other_file) ⇒ Object
-
#initialize(path:, issues:, hash: nil) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(path:, issues:, hash: nil) ⇒ File
Returns a new instance of File.
12 13 14 15 16 17 |
# File 'lib/rubocop/gradual/results/file.rb', line 12 def initialize(path:, issues:, hash: nil) @path = path @file_hash = hash || djb2a(data) @issues = prepare_issues(issues).sort @data = nil end |
Instance Attribute Details
#file_hash ⇒ Object (readonly)
Returns the value of attribute file_hash.
10 11 12 |
# File 'lib/rubocop/gradual/results/file.rb', line 10 def file_hash @file_hash end |
#issues ⇒ Object (readonly)
Returns the value of attribute issues.
10 11 12 |
# File 'lib/rubocop/gradual/results/file.rb', line 10 def issues @issues end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/rubocop/gradual/results/file.rb', line 10 def path @path end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
10 11 12 |
# File 'lib/rubocop/gradual/results/file.rb', line 10 def state @state end |
Instance Method Details
#<=>(other) ⇒ Object
19 20 21 |
# File 'lib/rubocop/gradual/results/file.rb', line 19 def <=>(other) path <=> other.path end |
#changed_issues(other_file) ⇒ Object
23 24 25 26 27 |
# File 'lib/rubocop/gradual/results/file.rb', line 23 def changed_issues(other_file) issues.reject do |result_issue| other_file.issues.find { |other_issue| result_issue == other_issue } end end |