Class: Lutaml::Model::Type::String
- Defined in:
- lib/lutaml/model/type/string.rb
Direct Known Subclasses
Base64Binary, HexBinary, Uri, Xml::W3c::XlinkActuateType, Xml::W3c::XlinkArcroleType, Xml::W3c::XlinkHrefType, Xml::W3c::XlinkRoleType, Xml::W3c::XlinkShowType, Xml::W3c::XlinkTitleType, Xml::W3c::XlinkTypeAttrType, Xml::W3c::XmlBaseType, Xml::W3c::XmlIdType, Xml::W3c::XmlLangType, Xml::W3c::XmlSpaceType, Xml::W3c::XsiNil, Xml::W3c::XsiNoNamespaceSchemaLocationType, Xml::W3c::XsiSchemaLocationType, Xml::W3c::XsiType
Constant Summary
Constants inherited from Value
Instance Attribute Summary
Attributes inherited from Value
Class Method Summary collapse
-
.cast(value, options = {}) ⇒ Object
Performance-optimized cast with short-circuit for already-correct types.
-
.default_xsd_type ⇒ String
Default XSD type for String.
Methods inherited from Value
format_type_serializer_for, from_format, #initialize, #initialized?, register_format_to_from_methods, register_format_type_serializer, serialize, #to_s
Methods included from Xml::Type::Configurable
Methods included from UninitializedClassGuard
Constructor Details
This class inherits a constructor from Lutaml::Model::Type::Value
Class Method Details
.cast(value, options = {}) ⇒ Object
Performance-optimized cast with short-circuit for already-correct types
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/lutaml/model/type/string.rb', line 8 def self.cast(value, = {}) return nil if value.nil? return value if Utils.uninitialized?(value) # Short-circuit: return immediately if already a String with no options # Use identity check for EMPTY_OPTIONS (faster than .empty?) if value.is_a?(::String) && .equal?(EMPTY_OPTIONS) return value end value = value.to_s unless .equal?(EMPTY_OPTIONS) Model::Services::Type::Validator::String.validate!(value, ) end value end |
.default_xsd_type ⇒ String
Default XSD type for String
28 29 30 |
# File 'lib/lutaml/model/type/string.rb', line 28 def self.default_xsd_type "xs:string" end |