Class: Lutaml::Xml::Type::ValueXmlMapping
- Inherits:
-
Object
- Object
- Lutaml::Xml::Type::ValueXmlMapping
- Includes:
- SharedDsl
- Defined in:
- lib/lutaml/xml/type/value_xml_mapping.rb
Overview
XML mapping configuration for Type::Value classes
This class holds the XML configuration for value types, including namespace and XSD type information.
Constant Summary
Constants included from SharedDsl
SharedDsl::VALID_XSD_TYPE_SYMBOLS
Instance Attribute Summary collapse
-
#namespace_class ⇒ Object
Returns the value of attribute namespace_class.
-
#xsd_type_name ⇒ Object
Returns the value of attribute xsd_type_name.
Instance Method Summary collapse
-
#deep_dup ⇒ ValueXmlMapping
Create a deep duplicate of this mapping.
-
#initialize ⇒ ValueXmlMapping
constructor
A new instance of ValueXmlMapping.
-
#namespace(ns_class_or_symbol) ⇒ void
Set the namespace for this Value type.
-
#namespace_prefix ⇒ String?
Get the namespace prefix for this mapping.
-
#namespace_uri ⇒ String?
Get the namespace URI for this mapping.
-
#xsd_type(type) ⇒ void
Set the XSD type name.
Methods included from SharedDsl
#resolve_xsd_type, #resolve_xsd_type_from_class, #resolve_xsd_type_from_symbol, #validate_namespace_class!
Constructor Details
#initialize ⇒ ValueXmlMapping
Returns a new instance of ValueXmlMapping.
21 22 23 24 |
# File 'lib/lutaml/xml/type/value_xml_mapping.rb', line 21 def initialize @namespace_class = nil @xsd_type_name = nil end |
Instance Attribute Details
#namespace_class ⇒ Object
Returns the value of attribute namespace_class.
19 20 21 |
# File 'lib/lutaml/xml/type/value_xml_mapping.rb', line 19 def namespace_class @namespace_class end |
#xsd_type_name ⇒ Object
Returns the value of attribute xsd_type_name.
19 20 21 |
# File 'lib/lutaml/xml/type/value_xml_mapping.rb', line 19 def xsd_type_name @xsd_type_name end |
Instance Method Details
#deep_dup ⇒ ValueXmlMapping
Create a deep duplicate of this mapping
Used for inheritance when a child type needs its own copy of the parent’s XML configuration.
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/lutaml/xml/type/value_xml_mapping.rb', line 81 def deep_dup self.class.new.tap do |dup| # namespace_class is a class reference, no need to deep copy dup.namespace_class = @namespace_class # xsd_type_name is a string, duplicate for safety if @xsd_type_name dup.xsd_type_name = @xsd_type_name.dup end end end |
#namespace(ns_class_or_symbol) ⇒ void
This method returns an undefined value.
Set the namespace for this Value type
41 42 43 44 |
# File 'lib/lutaml/xml/type/value_xml_mapping.rb', line 41 def namespace(ns_class_or_symbol) validate_namespace_class!(ns_class_or_symbol) @namespace_class = ns_class_or_symbol end |
#namespace_prefix ⇒ String?
Get the namespace prefix for this mapping
56 57 58 |
# File 'lib/lutaml/xml/type/value_xml_mapping.rb', line 56 def namespace_prefix @namespace_class&.prefix_default end |
#namespace_uri ⇒ String?
Get the namespace URI for this mapping
49 50 51 |
# File 'lib/lutaml/xml/type/value_xml_mapping.rb', line 49 def namespace_uri @namespace_class&.uri end |
#xsd_type(type) ⇒ void
This method returns an undefined value.
Set the XSD type name
70 71 72 |
# File 'lib/lutaml/xml/type/value_xml_mapping.rb', line 70 def xsd_type(type) @xsd_type_name = resolve_xsd_type(type) end |