Class: Lutaml::Xsd::NamespacePrefixInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/xsd/namespace_prefix_manager.rb

Overview

Value object for namespace prefix information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapping, repository) ⇒ NamespacePrefixInfo

Returns a new instance of NamespacePrefixInfo.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/lutaml/xsd/namespace_prefix_manager.rb', line 54

def initialize(mapping, repository)
  @prefix = mapping.prefix
  @uri = mapping.uri

  # Get schema location information
  manager = NamespacePrefixManager.new(repository)
  @package_location = manager.get_package_location(@uri)
  @original_schema_location = extract_original_location(repository)

  # Get type statistics
  types = repository.send(:types_in_namespace, @uri)
  @type_count = types.size
  @types_by_category = count_types_by_category(types)
end

Instance Attribute Details

#original_schema_locationObject (readonly)

Returns the value of attribute original_schema_location.



51
52
53
# File 'lib/lutaml/xsd/namespace_prefix_manager.rb', line 51

def original_schema_location
  @original_schema_location
end

#package_locationObject (readonly)

Returns the value of attribute package_location.



51
52
53
# File 'lib/lutaml/xsd/namespace_prefix_manager.rb', line 51

def package_location
  @package_location
end

#prefixObject (readonly)

Returns the value of attribute prefix.



51
52
53
# File 'lib/lutaml/xsd/namespace_prefix_manager.rb', line 51

def prefix
  @prefix
end

#type_countObject (readonly)

Returns the value of attribute type_count.



51
52
53
# File 'lib/lutaml/xsd/namespace_prefix_manager.rb', line 51

def type_count
  @type_count
end

#types_by_categoryObject (readonly)

Returns the value of attribute types_by_category.



51
52
53
# File 'lib/lutaml/xsd/namespace_prefix_manager.rb', line 51

def types_by_category
  @types_by_category
end

#uriObject (readonly)

Returns the value of attribute uri.



51
52
53
# File 'lib/lutaml/xsd/namespace_prefix_manager.rb', line 51

def uri
  @uri
end

Instance Method Details

#to_hHash

Convert to hash for JSON/YAML output

Returns:

  • (Hash)


71
72
73
74
75
76
77
78
79
80
# File 'lib/lutaml/xsd/namespace_prefix_manager.rb', line 71

def to_h
  {
    prefix: prefix,
    uri: uri,
    original_schema_location: original_schema_location,
    package_location: package_location,
    type_count: type_count,
    types_by_category: types_by_category,
  }
end