Class: SvgConform::QualityMetrics::ErrorBreakdown
- Inherits:
-
Lutaml::Model::Serializable
- Object
- Lutaml::Model::Serializable
- SvgConform::QualityMetrics::ErrorBreakdown
- Defined in:
- lib/svg_conform/quality_metrics/error_breakdown.rb
Overview
Immutable value object representing error breakdown by severity and remediability.
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
Value equality.
-
#clean? ⇒ Boolean
True if there are no errors.
-
#has_critical? ⇒ Boolean
True if any critical errors exist.
-
#has_non_remediable? ⇒ Boolean
True if any non-remediable errors exist.
- #hash ⇒ Object
-
#initialize(**args) ⇒ ErrorBreakdown
constructor
Ensure immutability after initialization.
-
#worst_severity ⇒ Symbol
Worst severity level present.
Constructor Details
#initialize(**args) ⇒ ErrorBreakdown
Ensure immutability after initialization
33 34 35 36 |
# File 'lib/svg_conform/quality_metrics/error_breakdown.rb', line 33 def initialize(**args) super(args) freeze end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
Value equality
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/svg_conform/quality_metrics/error_breakdown.rb', line 39 def ==(other) other.is_a?(ErrorBreakdown) && total == other.total && critical == other.critical && high == other.high && medium == other.medium && low == other.low && remediable == other.remediable && non_remediable == other.non_remediable end |
#clean? ⇒ Boolean
Returns true if there are no errors.
56 57 58 |
# File 'lib/svg_conform/quality_metrics/error_breakdown.rb', line 56 def clean? total.zero? end |
#has_critical? ⇒ Boolean
Returns true if any critical errors exist.
61 62 63 |
# File 'lib/svg_conform/quality_metrics/error_breakdown.rb', line 61 def has_critical? critical.positive? end |
#has_non_remediable? ⇒ Boolean
Returns true if any non-remediable errors exist.
66 67 68 |
# File 'lib/svg_conform/quality_metrics/error_breakdown.rb', line 66 def has_non_remediable? non_remediable.positive? end |
#hash ⇒ Object
51 52 53 |
# File 'lib/svg_conform/quality_metrics/error_breakdown.rb', line 51 def hash [total, critical, high, medium, low, remediable, non_remediable].hash end |
#worst_severity ⇒ Symbol
Returns Worst severity level present.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/svg_conform/quality_metrics/error_breakdown.rb', line 71 def worst_severity return :none if clean? return :critical if critical.positive? return :high if high.positive? return :medium if medium.positive? return :low if low.positive? :none end |