lutaml-model 0.8.201 → 0.8.203

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/.github/scripts/test_installed_gem.rb +1 -13
  3. data/.github/workflows/dependent-tests.yml +59 -2
  4. data/.github/workflows/downstream-performance.yml +1 -22
  5. data/.github/workflows/performance.yml +1 -33
  6. data/.github/workflows/rake.yml +2 -6
  7. data/.rubocop.yml +0 -10
  8. data/.rubocop_todo.yml +0 -4
  9. data/Gemfile +0 -23
  10. data/README.adoc +25 -86
  11. data/Rakefile +2 -167
  12. data/docs/_guides/advanced-mapping.adoc +6 -6
  13. data/docs/_guides/character-encoding.adoc +0 -3
  14. data/docs/_guides/gem-integration.adoc +1 -1
  15. data/docs/_guides/index.adoc +0 -4
  16. data/docs/_guides/xml/type-namespaces.adoc +1 -1
  17. data/docs/_guides/xml-guide-0.8.0.adoc +2 -2
  18. data/docs/_guides/xml-namespaces.adoc +2 -3
  19. data/docs/_guides/xml_mappings/03_architecture.adoc +2 -2
  20. data/docs/_guides/xml_mappings/07_best_practices.adoc +2 -3
  21. data/docs/_guides/xml_mappings/08_troubleshooting.adoc +1 -9
  22. data/docs/_pages/comparison-with-shale.adoc +1 -1
  23. data/docs/_pages/configuration.adoc +6 -40
  24. data/docs/_pages/index.adoc +0 -1
  25. data/docs/_pages/serialization_adapters.adoc +4 -16
  26. data/docs/_references/architecture.adoc +1 -1
  27. data/docs/_references/lutaml-namespace-planning.md +1 -1
  28. data/docs/_references/plan-schema-spec.adoc +45 -18
  29. data/docs/_references/three-phase-namespace-architecture.adoc +1 -2
  30. data/docs/_references/xsd-generation-with-namespace-support.adoc +3 -8
  31. data/docs/_tutorials/lutaml-xml-architecture.adoc +2 -8
  32. data/docs/architecture.md +7 -11
  33. data/docs/conversion_caching.adoc +1 -1
  34. data/docs/index.adoc +0 -1
  35. data/docs/key_value_data_model.adoc +1 -1
  36. data/docs/namespace-management.adoc +4 -10
  37. data/lib/lutaml/json/format.rb +0 -1
  38. data/lib/lutaml/json/generator_options.rb +0 -1
  39. data/lib/lutaml/key_value/transform.rb +149 -37
  40. data/lib/lutaml/lml/document_builder.rb +2 -2
  41. data/lib/lutaml/lml/entity_types.rb +2 -2
  42. data/lib/lutaml/model/adapter_resolver.rb +5 -15
  43. data/lib/lutaml/model/attribute.rb +11 -6
  44. data/lib/lutaml/model/cached_type_resolver.rb +1 -7
  45. data/lib/lutaml/model/error/unknown_adapter_type_error.rb +1 -1
  46. data/lib/lutaml/model/global_context.rb +3 -5
  47. data/lib/lutaml/model/instrumentation.rb +0 -3
  48. data/lib/lutaml/model/mapping/mapping_rule.rb +6 -10
  49. data/lib/lutaml/model/register.rb +20 -31
  50. data/lib/lutaml/model/runtime_compatibility.rb +0 -92
  51. data/lib/lutaml/model/schema/class_loader.rb +2 -4
  52. data/lib/lutaml/model/schema/xml_compiler/spec_builder/simple_types.rb +2 -3
  53. data/lib/lutaml/model/serialize/attribute_definition.rb +10 -184
  54. data/lib/lutaml/model/serialize/conversion_caching.rb +1 -5
  55. data/lib/lutaml/model/serialize/deserialization_context.rb +21 -0
  56. data/lib/lutaml/model/serialize/initialization.rb +19 -9
  57. data/lib/lutaml/model/serialize/model_import.rb +0 -5
  58. data/lib/lutaml/model/serialize/value_mapping.rb +0 -3
  59. data/lib/lutaml/model/services/rule_value_extractor.rb +4 -7
  60. data/lib/lutaml/model/store.rb +10 -17
  61. data/lib/lutaml/model/toml.rb +0 -2
  62. data/lib/lutaml/model/transformation_registry.rb +3 -7
  63. data/lib/lutaml/model/version.rb +1 -1
  64. data/lib/lutaml/model.rb +3 -19
  65. data/lib/lutaml/toml/format.rb +4 -8
  66. data/lib/lutaml/xml/adapter/moxml_adapter.rb +1 -7
  67. data/lib/lutaml/xml/adapter.rb +0 -4
  68. data/lib/lutaml/xml/adapter_loader.rb +1 -6
  69. data/lib/lutaml/xml/builder/base.rb +0 -3
  70. data/lib/lutaml/xml/builder.rb +0 -8
  71. data/lib/lutaml/xml/data_model.rb +1 -1
  72. data/lib/lutaml/xml/doctype_extractor.rb +3 -3
  73. data/lib/lutaml/xml/format.rb +22 -74
  74. data/lib/lutaml/xml/leptris/plan_compiler.rb +1 -2
  75. data/lib/lutaml/xml/model_transform.rb +14 -24
  76. data/lib/lutaml/xml/polymorphic_value_handler.rb +1 -1
  77. data/lib/lutaml/xml/schema/builder/moxml.rb +1 -1
  78. data/lib/lutaml/xml/schema/builder.rb +6 -9
  79. data/lib/lutaml/xml/schema/relaxng_schema.rb +1 -1
  80. data/lib/lutaml/xml/xml_element.rb +3 -2
  81. data/lib/lutaml/xml/xsd_validator.rb +4 -11
  82. data/lib/lutaml/yaml/adapter/yeptris_adapter.rb +2 -2
  83. data/lib/lutaml/yamls/adapter_loader.rb +1 -5
  84. data/lib/tasks/performance_comparator.rb +1 -1
  85. data/lutaml-model.gemspec +3 -8
  86. data/spec/address_person_spec.rb +8 -0
  87. data/spec/address_spec.rb +4 -0
  88. data/spec/benchmarks/xml_parsing_benchmark_spec.rb +1 -1
  89. data/spec/lutaml/json/adapter/standard_adapter_spec.rb +6 -9
  90. data/spec/lutaml/key_value/group_instantiate_spec.rb +204 -1
  91. data/spec/lutaml/model/adapter_resolver_yeptris_switch_spec.rb +0 -2
  92. data/spec/lutaml/model/cached_type_resolver_spec.rb +2 -54
  93. data/spec/lutaml/model/cdata_spec.rb +2 -15
  94. data/spec/lutaml/model/encoding_spec.rb +0 -9
  95. data/spec/lutaml/model/except_spec.rb +0 -7
  96. data/spec/lutaml/model/json_spec.rb +0 -14
  97. data/spec/lutaml/model/mixed_content_spec.rb +6 -46
  98. data/spec/lutaml/model/ordered_content_spec.rb +0 -7
  99. data/spec/lutaml/model/processing_instruction_spec.rb +0 -6
  100. data/spec/lutaml/model/runtime_compatibility_spec.rb +0 -37
  101. data/spec/lutaml/model/serializable_spec.rb +0 -2
  102. data/spec/lutaml/model/serialize/deserialization_context_spec.rb +68 -0
  103. data/spec/lutaml/model/toml_spec.rb +0 -23
  104. data/spec/lutaml/xml/adapter/base_adapter_regression_spec.rb +0 -4
  105. data/spec/lutaml/xml/adapter/order_spec.rb +1 -1
  106. data/spec/lutaml/xml/adapter/xml_namespace_spec.rb +0 -7
  107. data/spec/lutaml/xml/attribute_namespace_disjointness_spec.rb +6 -6
  108. data/spec/lutaml/xml/builder/builder_spec.rb +0 -24
  109. data/spec/lutaml/xml/default_namespace_spec.rb +1 -8
  110. data/spec/lutaml/xml/doctype_preservation_spec.rb +0 -4
  111. data/spec/lutaml/xml/entity_fragmentation_spec.rb +0 -6
  112. data/spec/lutaml/xml/fpi_namespace_spec.rb +0 -21
  113. data/spec/lutaml/xml/mapping_spec.rb +8 -15
  114. data/spec/lutaml/xml/namespace_scope_vcard_spec.rb +0 -7
  115. data/spec/lutaml/xml/namespace_spec.rb +0 -13
  116. data/spec/lutaml/xml/prefix_control_spec.rb +0 -6
  117. data/spec/lutaml/xml/schema/builder_moxml_spec.rb +1 -1
  118. data/spec/lutaml/xml/xml_adapter_spec.rb +0 -7
  119. data/spec/lutaml/xml/xml_spec.rb +2 -88
  120. data/spec/spec_helper.rb +8 -28
  121. data/spec/support/test_adapter_config.rb +6 -6
  122. metadata +2 -32
  123. data/.github/workflows/js-pr-check.yml +0 -106
  124. data/.github/workflows/js-sync.yml +0 -55
  125. data/.github/workflows/opal.yml +0 -65
  126. data/.gitmodules +0 -6
  127. data/.rspec-opal +0 -5
  128. data/docs/_guides/opal.adoc +0 -232
  129. data/lib/compat/opal/generate_boot.rb +0 -137
  130. data/lib/compat/opal/js_bundle_entry.rb +0 -42
  131. data/lib/compat/opal/lutaml_model_boot.rb +0 -638
  132. data/lib/compat/opal/monitor.rb +0 -31
  133. data/lib/compat/opal/moxml/adapter/customized_rexml/entity_reference.rb +0 -9
  134. data/lib/compat/opal/moxml/adapter/customized_rexml/formatter.rb +0 -225
  135. data/lib/compat/opal/moxml/adapter/customized_rexml.rb +0 -11
  136. data/lib/compat/opal/moxml_boot.rb +0 -68
  137. data/lib/compat/opal/objectspace_shim.rb +0 -23
  138. data/lib/compat/opal/rexml/namespace.rb +0 -59
  139. data/lib/compat/opal/rexml/parsers/baseparser.rb +0 -1016
  140. data/lib/compat/opal/rexml/source.rb +0 -214
  141. data/lib/compat/opal/rexml/text.rb +0 -426
  142. data/lib/compat/opal/rexml/xmltokens.rb +0 -45
  143. data/lib/compat/opal/rexml_compat.rb +0 -85
  144. data/lib/compat/opal/yaml_compat.rb +0 -32
  145. data/lib/lutaml/model/cached_type_resolver/mutex_hash_cache.rb +0 -53
  146. data/lib/lutaml/model/schema/schema_builder/oga.rb +0 -92
  147. data/lib/lutaml/xml/schema/builder/oga.rb +0 -92
  148. data/spec/lutaml/model/boot_manifest_spec.rb +0 -30
  149. data/spec/lutaml/model/opal_smoke_spec.rb +0 -199
  150. data/spec/lutaml/model/serialize/attribute_definition_block_form_spec.rb +0 -244
  151. data/spec/lutaml/xml/adapter/oga_adapter_spec.rb +0 -135
  152. data/spec/lutaml/xml/opal_xml_spec.rb +0 -204
  153. data/spec/support/opal.rb +0 -9
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Opal shim: the monitor stdlib (MonitorMixin) is not packaged for
4
- # Opal, and moxml 0.6's NativeAttachment requires it at load time.
5
- # The JS runtime is single-threaded, so the monitor contract reduces
6
- # to pass-through: synchronize yields, lock/try_lock succeed, unlock
7
- # is a no-op. Aliases cover the MonitorMixin spellings.
8
- #
9
- class Monitor # rubocop:disable Naming/PredicateMethod -- stdlib spellings
10
- def synchronize
11
- yield
12
- end
13
-
14
- def lock; end
15
-
16
- def try_lock
17
- true
18
- end
19
-
20
- def unlock; end
21
-
22
- def locked?
23
- false
24
- end
25
-
26
- alias mon_enter lock
27
- alias mon_exit unlock
28
- alias mon_synchronize synchronize
29
- alias mon_locked? locked?
30
- alias mon_try_lock try_lock
31
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Moxml
4
- module Adapter
5
- module CustomizedRexml
6
- EntityReference = ::Moxml::Entity::Reference
7
- end
8
- end
9
- end
@@ -1,225 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rexml/formatters/pretty"
4
-
5
- module Moxml
6
- module Adapter
7
- module CustomizedRexml
8
- # Custom REXML formatter that fixes indentation and wrapping issues
9
- class Formatter < ::REXML::Formatters::Pretty
10
- def initialize(indentation: 2, self_close_empty: false, adapter: nil)
11
- @indentation = " " * indentation
12
- @level = 0
13
- @compact = true
14
- @width = -1 # Disable line wrapping
15
- @self_close_empty = self_close_empty
16
- @adapter = adapter
17
- end
18
-
19
- def write(node, output)
20
- case node
21
- when ::REXML::XMLDecl
22
- write_declaration(node, output)
23
- when ::Moxml::Adapter::CustomizedRexml::EntityReference
24
- output << "&#{node.name};"
25
- else
26
- super
27
- end
28
- end
29
-
30
- def indented?
31
- !@indentation.empty?
32
- end
33
-
34
- def write_element(node, output)
35
- output << "<#{node.expanded_name}"
36
- write_attributes(node, output)
37
-
38
- # Check for entity refs stored in adapter attachments
39
- entity_refs = @adapter&.attachments&.get(node, :entity_refs)
40
- child_sequence = @adapter&.attachments&.get(node, :child_sequence)
41
-
42
- has_no_children = node.children.empty? && !(entity_refs && !entity_refs.empty?)
43
-
44
- if has_no_children && @self_close_empty
45
- output << "/>"
46
- return
47
- end
48
-
49
- output << ">"
50
-
51
- has_text = node.children.any? { |c| c.is_a?(::REXML::Text) && !c.to_s.strip.empty? }
52
- has_elements = node.children.any?(::REXML::Element)
53
- indent_children = indented? && has_elements && !has_text
54
-
55
- # Handle children based on content type
56
- all_children_empty = node.children.empty? && !(entity_refs && !entity_refs.empty?)
57
- unless all_children_empty
58
- @level += @indentation.length if indent_children
59
-
60
- if entity_refs && !entity_refs.empty? && child_sequence
61
- eref_idx = 0
62
- native_idx = 0
63
- child_sequence.each do |type|
64
- case type
65
- when :native
66
- if native_idx < node.children.size
67
- child = node.children[native_idx]
68
- native_idx += 1
69
- next if child.is_a?(::REXML::Text) &&
70
- child.to_s.strip.empty? &&
71
- !(child.next_sibling.nil? && child.previous_sibling.nil?)
72
-
73
- output << "\n" << (" " * @level) if indent_children
74
- write(child, output)
75
- end
76
- when :eref
77
- if eref_idx < entity_refs.size
78
- output << "\n" << (" " * @level) if indent_children
79
- write(entity_refs[eref_idx], output)
80
- eref_idx += 1
81
- end
82
- end
83
- end
84
- else
85
- node.children.each_with_index do |child, _index|
86
- next if child.is_a?(::REXML::Text) &&
87
- child.to_s.strip.empty? &&
88
- !(child.next_sibling.nil? && child.previous_sibling.nil?)
89
-
90
- output << "\n" << (" " * @level) if indent_children
91
- write(child, output)
92
- end
93
- end
94
-
95
- if indent_children
96
- @level -= @indentation.length
97
- output << "\n" << (" " * @level)
98
- end
99
- end
100
-
101
- output << "</#{node.expanded_name}>"
102
- end
103
-
104
- def write_text(node, output)
105
- text = node.value
106
- return if text.empty?
107
-
108
- output << escape_text(text)
109
- end
110
-
111
- def escape_text(text)
112
- text.to_s.gsub(/[<>&]/) do |match|
113
- case match
114
- when "<" then "&lt;"
115
- when ">" then "&gt;"
116
- when "&" then "&amp;"
117
- end
118
- end
119
- end
120
-
121
- private
122
-
123
- def find_significant_sibling(node, direction)
124
- method = direction == :next ? :next_sibling : :previous_sibling
125
- sibling = node.send(method)
126
- sibling = sibling.send(method) while sibling.is_a?(::REXML::Text) && sibling.to_s.strip.empty?
127
- sibling
128
- end
129
-
130
- def write_cdata(node, output)
131
- # output << ' ' * @level
132
- output << ::REXML::CData::START
133
- output << node.to_s.gsub(::REXML::CData::STOP, "]]]]><![CDATA[>")
134
- output << ::REXML::CData::STOP
135
- # output << "\n"
136
- end
137
-
138
- def write_comment(node, output)
139
- # output << ' ' * @level
140
- output << "<!--"
141
- output << node.to_s
142
- output << "-->"
143
- # output << "\n"
144
- end
145
-
146
- def write_instruction(node, output)
147
- # output << ' ' * @level
148
- output << "<?"
149
- output << node.target
150
- output << " "
151
- output << node.content if node.content
152
- output << "?>"
153
- # output << "\n"
154
- end
155
-
156
- def write_document(node, output)
157
- node.children.each do |child|
158
- write(child, output)
159
- # output << "\n" unless child == node.children.last
160
- end
161
- end
162
-
163
- def write_doctype(node, output)
164
- output << "<!DOCTYPE "
165
- output << node.name
166
- output << " "
167
- output << node.external_id if node.external_id
168
- output << ">"
169
- # output << "\n"
170
- end
171
-
172
- def write_declaration(node, output)
173
- output << "<?xml"
174
- output << %( version="#{node.version}") if node.version
175
- if node.writeencoding
176
- output << %( encoding="#{node.encoding.to_s.upcase}")
177
- end
178
- output << %( standalone="#{node.standalone}") if node.standalone
179
- output << "?>"
180
- # output << "\n"
181
- end
182
-
183
- def write_attributes(node, output)
184
- # First write namespace declarations
185
- node.attributes.each do |name, attr|
186
- next unless name.to_s.start_with?("xmlns:") || name.to_s == "xmlns"
187
-
188
- name = "xmlns" if name.to_s == "xmlns:"
189
- value = attr.is_a?(::REXML::Attribute) ? attr.value : attr
190
- output << " #{name}=\"#{value}\""
191
- end
192
-
193
- # Then write regular attributes
194
- node.attributes.each do |name, attr| # rubocop:disable Style/CombinableLoops
195
- next if name.to_s.start_with?("xmlns:") || name.to_s == "xmlns"
196
-
197
- output << " "
198
- output << if attr.is_a?(::REXML::Attribute) && attr.prefix
199
- "#{attr.prefix}:#{attr.name}"
200
- else
201
- name.to_s
202
- end
203
-
204
- output << "=\""
205
- value = attr.is_a?(::REXML::Attribute) ? attr.value : attr
206
- output << escape_attribute_value(value.to_s)
207
- output << "\""
208
- end # rubocop:enable Style/CombinableLoops
209
- end
210
-
211
- def escape_attribute_value(value)
212
- value.to_s.gsub(/[<>&"]/) do |match|
213
- case match
214
- when "<" then "&lt;"
215
- when ">" then "&gt;"
216
- when "&" then "&amp;"
217
- when '"' then "&quot;"
218
- # when "'" then '&apos;'
219
- end
220
- end
221
- end
222
- end
223
- end
224
- end
225
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Moxml
4
- module Adapter
5
- module CustomizedRexml
6
- autoload :EntityReference,
7
- "moxml/adapter/customized_rexml/entity_reference"
8
- autoload :Formatter, "moxml/adapter/customized_rexml/formatter"
9
- end
10
- end
11
- end
@@ -1,68 +0,0 @@
1
- require "moxml/version"
2
-
3
- # ObjectSpace shim: moxml 0.6 registers GC finalizers on Opal, which
4
- # carries no ObjectSpace constant; the shim is a guarded no-op there.
5
- require "objectspace_shim"
6
-
7
- # The monitor shim must load before moxml files: moxml 0.6's
8
- # NativeAttachment requires "monitor" at load time.
9
- require "monitor"
10
- require "moxml/error"
11
- require "moxml/native_attachment"
12
- require "moxml/xml_utils"
13
- require "moxml/xml_utils/encoder"
14
- require "moxml/node"
15
- require "moxml/node_set"
16
- require "moxml/lazy_node_set"
17
- require "moxml/document"
18
- require "moxml/element"
19
- require "moxml/attribute"
20
- require "moxml/text"
21
- require "moxml/cdata"
22
- require "moxml/comment"
23
- require "moxml/processing_instruction"
24
- require "moxml/declaration"
25
- require "moxml/namespace"
26
- require "moxml/doctype"
27
- require "moxml/entity_reference"
28
- require "moxml/entity_registry"
29
- require "moxml/entity"
30
- require "moxml/entity/restorer"
31
- require "moxml/entity/reference"
32
- require "moxml/xml_emitter"
33
- require "moxml/adapter"
34
- require "moxml/adapter/base"
35
- require "moxml/adapter/customized_rexml"
36
- require "moxml/adapter/customized_rexml/entity_reference"
37
- require "moxml/adapter/customized_rexml/formatter"
38
- require "moxml/sax"
39
- require "moxml/sax/handler"
40
- require "moxml/sax/element_handler"
41
- require "moxml/sax/block_handler"
42
- require "moxml/sax/namespace_splitter"
43
- require "moxml/adapter/rexml"
44
- require "moxml/adapter/customized_oga"
45
- require "moxml/adapter/customized_oga/entity_decoder"
46
- require "moxml/adapter/customized_oga/raw_value_override"
47
- require "moxml/adapter/customized_oga/xml_declaration"
48
- require "moxml/adapter/customized_oga/xml_generator"
49
- require "moxml/adapter/oga"
50
- require "moxml/builder"
51
- require "moxml/context"
52
- require "moxml/config"
53
- require "moxml/xpath"
54
- require "moxml/xpath/engine"
55
- require "moxml/xpath/context"
56
- require "moxml/xpath/conversion"
57
- require "moxml/xpath/cache"
58
- require "moxml/xpath/lexer"
59
- require "moxml/xpath/parser"
60
- require "moxml/xpath/compiler"
61
- require "moxml/xpath/errors"
62
- require "moxml/xpath/ast/node"
63
- require "moxml/xpath/ruby/node"
64
- require "moxml/xpath/ruby/generator"
65
- require "moxml/reference"
66
- require "moxml/reference/parser"
67
- require "moxml/reference/writer"
68
- require "moxml/reference/normalizer"
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Opal shim: moxml 0.6's NativeAttachment::Native registers GC
4
- # finalizers through ObjectSpace; JS has no finalization hook, and the
5
- # Opal runtime does not carry an ObjectSpace at all (the constant is
6
- # simply absent, so the call site NameErrors). A stubbed ObjectSpace
7
- # degrades finalizer cleanup — attachments live for the process
8
- # lifetime, which on the single-threaded JS runtime is the page's
9
- # lifetime anyway. Existing runtimes that do define ObjectSpace are
10
- # left untouched.
11
- unless defined?(ObjectSpace)
12
- module ObjectSpace
13
- class << self
14
- def define_finalizer(_obj, _proc = nil)
15
- nil
16
- end
17
-
18
- def undefine_finalizer(_obj)
19
- nil
20
- end
21
- end
22
- end
23
- end
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rexml/xmltokens"
4
-
5
- module REXML
6
- module Namespace
7
- attr_reader :name, :expanded_name
8
- attr_accessor :prefix
9
-
10
- include XMLTokens
11
-
12
- NAME_WITHOUT_NAMESPACE = /^#{NCNAME_STR}$/
13
- NAMESPLIT = /^(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})/u
14
-
15
- def name=(name)
16
- @expanded_name = name
17
- if name.match?(NAME_WITHOUT_NAMESPACE)
18
- @prefix = ""
19
- @namespace = ""
20
- @name = name
21
- elsif name =~ NAMESPLIT
22
- if $1
23
- @prefix = $1
24
- else
25
- @prefix = ""
26
- @namespace = ""
27
- end
28
- @name = $2
29
- elsif name == ""
30
- @prefix = nil
31
- @namespace = nil
32
- @name = nil
33
- else
34
- message = "name must be \#{PREFIX}:\#{LOCAL_NAME} or \#{LOCAL_NAME}: "
35
- message += "<#{name.inspect}>"
36
- raise ArgumentError, message
37
- end
38
- end
39
-
40
- def has_name?(other, ns = nil)
41
- if ns
42
- namespace == ns and name == other
43
- elsif other.include? ":"
44
- fully_expanded_name == other
45
- else
46
- name == other
47
- end
48
- end
49
-
50
- alias :local_name :name
51
-
52
- def fully_expanded_name
53
- ns = prefix
54
- return "#{ns}:#@name" if ns.size.positive?
55
-
56
- @name
57
- end
58
- end
59
- end