Class: Rubocop::Report::Report
- Inherits:
-
Object
- Object
- Rubocop::Report::Report
- Defined in:
- lib/rubocop/report/report.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
-
#<<(cop) ⇒ Object
Appends offences registered by cops to the report.
- #empty? ⇒ Boolean
- #entries ⇒ Object
-
#initialize(filename) ⇒ Report
constructor
A new instance of Report.
Constructor Details
#initialize(filename) ⇒ Report
Returns a new instance of Report.
22 23 24 25 |
# File 'lib/rubocop/report/report.rb', line 22 def initialize(filename) @filename = filename @entries = [] end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
19 20 21 |
# File 'lib/rubocop/report/report.rb', line 19 def filename @filename end |
Instance Method Details
#<<(cop) ⇒ Object
Appends offences registered by cops to the report.
29 30 31 32 33 |
# File 'lib/rubocop/report/report.rb', line 29 def <<(cop) cop.offences.each do |entry| @entries << entry end end |
#empty? ⇒ Boolean
39 40 41 |
# File 'lib/rubocop/report/report.rb', line 39 def empty? entries.empty? end |
#entries ⇒ Object
35 36 37 |
# File 'lib/rubocop/report/report.rb', line 35 def entries @entries.sort_by(&:line_number) end |