Class: Gitlab::Badge::Coverage::Report
- Defined in:
- lib/gitlab/badge/coverage/report.rb
Overview
Test coverage report badge
Instance Attribute Summary collapse
-
#customization ⇒ Object
readonly
Returns the value of attribute customization.
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
Instance Method Summary collapse
- #entity ⇒ Object
-
#initialize(project, ref, opts: { job: nil }) ⇒ Report
constructor
A new instance of Report.
- #metadata ⇒ Object
- #status ⇒ Object
- #template ⇒ Object
Constructor Details
#initialize(project, ref, opts: { job: nil }) ⇒ Report
Returns a new instance of Report.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/gitlab/badge/coverage/report.rb', line 12 def initialize(project, ref, opts: { job: nil }) @project = project @ref = ref @job = opts[:job] @customization = { key_width: opts[:key_width].to_i, key_text: opts[:key_text] } @pipeline = @project.ci_pipelines.latest_successful_for_ref(@ref) end |
Instance Attribute Details
#customization ⇒ Object (readonly)
Returns the value of attribute customization
10 11 12 |
# File 'lib/gitlab/badge/coverage/report.rb', line 10 def customization @customization end |
#job ⇒ Object (readonly)
Returns the value of attribute job
10 11 12 |
# File 'lib/gitlab/badge/coverage/report.rb', line 10 def job @job end |
#project ⇒ Object (readonly)
Returns the value of attribute project
10 11 12 |
# File 'lib/gitlab/badge/coverage/report.rb', line 10 def project @project end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref
10 11 12 |
# File 'lib/gitlab/badge/coverage/report.rb', line 10 def ref @ref end |
Instance Method Details
#entity ⇒ Object
24 25 26 |
# File 'lib/gitlab/badge/coverage/report.rb', line 24 def entity 'coverage' end |
#metadata ⇒ Object
35 36 37 |
# File 'lib/gitlab/badge/coverage/report.rb', line 35 def @metadata ||= Coverage::Metadata.new(self) end |
#status ⇒ Object
28 29 30 31 32 33 |
# File 'lib/gitlab/badge/coverage/report.rb', line 28 def status @coverage ||= raw_coverage return unless @coverage @coverage.to_f.round(2) end |