Class: Gitlab::Ci::Reports::CoverageReport
- Inherits:
-
Object
- Object
- Gitlab::Ci::Reports::CoverageReport
- Defined in:
- lib/gitlab/ci/reports/coverage_report.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
- #add_file(name, line_coverage) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ CoverageReport
constructor
A new instance of CoverageReport.
- #pick(keys) ⇒ Object
Constructor Details
#initialize ⇒ CoverageReport
Returns a new instance of CoverageReport.
9 10 11 |
# File 'lib/gitlab/ci/reports/coverage_report.rb', line 9 def initialize @files = {} end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
7 8 9 |
# File 'lib/gitlab/ci/reports/coverage_report.rb', line 7 def files @files end |
Instance Method Details
#add_file(name, line_coverage) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/gitlab/ci/reports/coverage_report.rb', line 25 def add_file(name, line_coverage) if files[name].present? line_coverage.each { |line, hits| combine_lines(name, line, hits) } else files[name] = line_coverage end end |
#empty? ⇒ Boolean
13 14 15 |
# File 'lib/gitlab/ci/reports/coverage_report.rb', line 13 def empty? @files.empty? end |
#pick(keys) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/gitlab/ci/reports/coverage_report.rb', line 17 def pick(keys) coverage_files = files.select do |key| keys.include?(key) end { files: coverage_files } end |