Class: CovLoupe::Presenters::BaseCoveragePresenter
- Inherits:
-
Object
- Object
- CovLoupe::Presenters::BaseCoveragePresenter
- Includes:
- PayloadCaching
- Defined in:
- lib/cov_loupe/presenters/base_coverage_presenter.rb
Overview
Shared presenter behavior for single-file coverage payloads.
Subclasses must implement #build_payload, which calls a CoverageModel method (e.g., :summary_for, :raw_for) for the given file path. The base class enriches the payload with staleness status from model.staleness_for.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(model:, path:) ⇒ BaseCoveragePresenter
constructor
A new instance of BaseCoveragePresenter.
-
#relative_path ⇒ Object
Returns the relativized file path used in CLI output.
-
#stale ⇒ Object
Returns the cached stale status for the file.
Methods included from PayloadCaching
#absolute_payload, #relativized_payload
Constructor Details
#initialize(model:, path:) ⇒ BaseCoveragePresenter
Returns a new instance of BaseCoveragePresenter.
17 18 19 20 |
# File 'lib/cov_loupe/presenters/base_coverage_presenter.rb', line 17 def initialize(model:, path:) @model = model @path = path end |
Instance Attribute Details
#model ⇒ Object (readonly)
Returns the value of attribute model.
15 16 17 |
# File 'lib/cov_loupe/presenters/base_coverage_presenter.rb', line 15 def model @model end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
15 16 17 |
# File 'lib/cov_loupe/presenters/base_coverage_presenter.rb', line 15 def path @path end |
Instance Method Details
#relative_path ⇒ Object
Returns the relativized file path used in CLI output.
28 29 30 |
# File 'lib/cov_loupe/presenters/base_coverage_presenter.rb', line 28 def relative_path relativized_payload['file'] end |
#stale ⇒ Object
Returns the cached stale status for the file.
23 24 25 |
# File 'lib/cov_loupe/presenters/base_coverage_presenter.rb', line 23 def stale absolute_payload['stale'] end |