Class: Lutaml::Xsd::NamespaceRemapper

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

Overview

Remaps namespace prefixes in a package Single responsibility: create new package with updated prefixes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ NamespaceRemapper

Returns a new instance of NamespaceRemapper.



10
11
12
# File 'lib/lutaml/xsd/namespace_remapper.rb', line 10

def initialize(repository)
  @repository = repository
end

Instance Attribute Details

#repositoryObject (readonly)

Returns the value of attribute repository.



8
9
10
# File 'lib/lutaml/xsd/namespace_remapper.rb', line 8

def repository
  @repository
end

Instance Method Details

#remap(changes) ⇒ SchemaRepository

Remap prefixes

Parameters:

  • changes (Hash)

    Mapping of old_prefix => new_prefix

Returns:



17
18
19
20
21
22
23
24
25
26
# File 'lib/lutaml/xsd/namespace_remapper.rb', line 17

def remap(changes)
  # Validate changes
  validate_changes(changes)

  # Apply changes to namespace mappings
  new_mappings = apply_changes(changes)

  # Create new repository with updated mappings
  repository_with_new_mappings(new_mappings)
end