Class: Lutaml::Xsd::SchemaRepositoryStatistics

Inherits:
Model::Serializable
  • Object
show all
Defined in:
lib/lutaml/xsd/schema_repository_metadata.rb

Overview

Statistics about a schema repository

Class Method Summary collapse

Class Method Details

.from_statistics(stats) ⇒ SchemaRepositoryStatistics

Create from statistics hash

Parameters:

  • stats (Hash)

    Statistics hash

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/lutaml/xsd/schema_repository_metadata.rb', line 39

def self.from_statistics(stats)
  # Convert types_by_category hash to array of TypeCategoryCount objects
  types_by_cat_hash = stats[:types_by_category] || {}
  types_by_cat_array = types_by_cat_hash.map do |category, count|
    TypeCategoryCount.new(category: category.to_s, count: count)
  end

  new(
    total_schemas: stats[:total_schemas],
    total_types: stats[:total_types],
    types_by_category: types_by_cat_array,
    total_namespaces: stats[:total_namespaces],
    namespace_prefixes: stats[:namespace_prefixes],
    resolved: stats[:resolved],
    validated: stats[:validated],
  )
end