Class: Lutaml::Xsd::Conflicts::NamespaceConflict
- Inherits:
-
Model::Serializable
- Object
- Model::Serializable
- Lutaml::Xsd::Conflicts::NamespaceConflict
- Defined in:
- lib/lutaml/xsd/conflicts/namespace_conflict.rb
Overview
Namespace URI conflict between packages Serializable for reporting
Instance Attribute Summary collapse
-
#sources ⇒ Object
Runtime-only (not serialized).
Class Method Summary collapse
-
.from_sources(namespace_uri:, sources:) ⇒ NamespaceConflict
Create from PackageSource objects.
Instance Method Summary collapse
- #conflict_count ⇒ Object
- #detailed_description ⇒ Object
- #highest_priority_source ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#sources ⇒ Object
Runtime-only (not serialized)
20 21 22 |
# File 'lib/lutaml/xsd/conflicts/namespace_conflict.rb', line 20 def sources @sources end |
Class Method Details
.from_sources(namespace_uri:, sources:) ⇒ NamespaceConflict
Create from PackageSource objects
26 27 28 29 30 31 32 33 34 |
# File 'lib/lutaml/xsd/conflicts/namespace_conflict.rb', line 26 def self.from_sources(namespace_uri:, sources:) conflict = new( namespace_uri: namespace_uri, package_paths: sources.map(&:package_path), priorities: sources.map(&:priority), ) conflict.sources = sources conflict end |
Instance Method Details
#conflict_count ⇒ Object
36 37 38 |
# File 'lib/lutaml/xsd/conflicts/namespace_conflict.rb', line 36 def conflict_count package_paths.size end |
#detailed_description ⇒ Object
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/lutaml/xsd/conflicts/namespace_conflict.rb', line 48 def detailed_description lines = [] lines << "Namespace URI Conflict:" lines << " Namespace: {#{namespace_uri}}" lines << " Defined in packages:" package_paths.each_with_index do |path, idx| lines << " - #{path} (priority: #{priorities[idx]})" end lines.join("\n") end |
#highest_priority_source ⇒ Object
40 41 42 |
# File 'lib/lutaml/xsd/conflicts/namespace_conflict.rb', line 40 def highest_priority_source sources&.min_by(&:priority) end |
#to_s ⇒ Object
44 45 46 |
# File 'lib/lutaml/xsd/conflicts/namespace_conflict.rb', line 44 def to_s "Namespace '{#{namespace_uri}}' defined in #{conflict_count} packages" end |