Class: Lutaml::Xsd::CoverageReport
- Inherits:
-
Object
- Object
- Lutaml::Xsd::CoverageReport
- Defined in:
- lib/lutaml/xsd/coverage_analyzer.rb
Overview
Value object representing coverage analysis results Immutable data structure with computed properties
Instance Attribute Summary collapse
-
#all_types ⇒ Object
readonly
Returns the value of attribute all_types.
-
#by_namespace ⇒ Object
readonly
Returns the value of attribute by_namespace.
-
#entry_types ⇒ Object
readonly
Returns the value of attribute entry_types.
-
#used_types ⇒ Object
readonly
Returns the value of attribute used_types.
Instance Method Summary collapse
-
#coverage_percentage ⇒ Float
Overall coverage percentage.
-
#initialize(all_types:, used_types:, entry_types:, by_namespace:) ⇒ CoverageReport
constructor
A new instance of CoverageReport.
-
#to_h ⇒ Hash
Convert to hash for serialization.
-
#total_types ⇒ Integer
Total number of types in the repository.
-
#unused_count ⇒ Integer
Number of unused types.
-
#unused_types ⇒ Set<String>
Get unused types (MECE: mutually exclusive with used_types).
-
#used_count ⇒ Integer
Number of used types.
Constructor Details
#initialize(all_types:, used_types:, entry_types:, by_namespace:) ⇒ CoverageReport
Returns a new instance of CoverageReport.
152 153 154 155 156 157 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 152 def initialize(all_types:, used_types:, entry_types:, by_namespace:) @all_types = all_types @used_types = used_types @entry_types = entry_types @by_namespace = by_namespace end |
Instance Attribute Details
#all_types ⇒ Object (readonly)
Returns the value of attribute all_types.
150 151 152 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 150 def all_types @all_types end |
#by_namespace ⇒ Object (readonly)
Returns the value of attribute by_namespace.
150 151 152 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 150 def by_namespace @by_namespace end |
#entry_types ⇒ Object (readonly)
Returns the value of attribute entry_types.
150 151 152 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 150 def entry_types @entry_types end |
#used_types ⇒ Object (readonly)
Returns the value of attribute used_types.
150 151 152 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 150 def used_types @used_types end |
Instance Method Details
#coverage_percentage ⇒ Float
Overall coverage percentage
185 186 187 188 189 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 185 def coverage_percentage return 0.0 if total_types.zero? (used_count.to_f / total_types * 100).round(2) end |
#to_h ⇒ Hash
Convert to hash for serialization
193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 193 def to_h { summary: { total_types: total_types, used_types: used_count, unused_types: unused_count, coverage_percentage: coverage_percentage, entry_types: entry_types, }, by_namespace: format_namespace_data, unused_type_details: format_unused_types, } end |
#total_types ⇒ Integer
Total number of types in the repository
161 162 163 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 161 def total_types all_types.size end |
#unused_count ⇒ Integer
Number of unused types
179 180 181 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 179 def unused_count unused_types.size end |
#unused_types ⇒ Set<String>
Get unused types (MECE: mutually exclusive with used_types)
173 174 175 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 173 def unused_types all_types - used_types end |
#used_count ⇒ Integer
Number of used types
167 168 169 |
# File 'lib/lutaml/xsd/coverage_analyzer.rb', line 167 def used_count used_types.size end |