Class: Lutaml::Xml::Schema::Xsd::TypeResolutionResult
- Inherits:
-
Model::Serializable
- Object
- Model::Serializable
- Lutaml::Xml::Schema::Xsd::TypeResolutionResult
- Defined in:
- lib/lutaml/xml/schema/xsd/type_resolution_result.rb
Overview
Represents the result of resolving a qualified type name
Constant Summary
Constants included from Model::Serialize
Model::Serialize::DEFAULT_VALUE_MAP, Model::Serialize::INTERNAL_ATTRIBUTES, Model::Serialize::LAZY_EMPTY_COLLECTION
Instance Attribute Summary collapse
-
#definition ⇒ Object
The resolved type definition (SimpleType, ComplexType, Element, etc.) Note: This is not serialized in YAML as it’s a complex object reference.
Attributes included from Model::Serialize
#lutaml_parent, #lutaml_register, #lutaml_root
Class Method Summary collapse
-
.failure(qname:, error_message:, namespace: nil, local_name: nil, resolution_path: []) ⇒ TypeResolutionResult
Create a failed resolution result.
-
.success(qname:, namespace:, local_name:, definition:, schema_file:, resolution_path: []) ⇒ TypeResolutionResult
Create a successful resolution result.
Instance Method Summary collapse
-
#resolved? ⇒ Boolean
Check if the type was successfully resolved.
-
#type_class ⇒ String?
Get the type class name if definition is available.
-
#type_name ⇒ String?
Get the type name from the definition if available.
Methods included from Model::Serialize
#attr_value, #attribute_exist?, #extract_register_id, included, #init_deserialization_state, #initialize, #key_exist?, #key_value, #method_missing, #prepare_instance_format_options, #pretty_print_instance_variables, register_format_mapping_method, register_from_format_method, register_to_format_method, #respond_to_missing?, #to_format, #to_yaml_hash, #using_default?, #using_default_for, #validate_attribute!, #validate_root_mapping!, #value_map, #value_set_for
Methods included from Model::Liquefiable
Methods included from Model::Validation
#format_element_sequences, #order_names, #validate, #validate!, #validate_helper, #validate_sequence!
Methods included from Model::ComparableModel
#already_compared?, #attributes_hash, #calculate_hash, #comparison_key, #eql?, #hash, included, #same_class?
Methods included from Model::Serialize::Builder
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Lutaml::Model::Serialize
Instance Attribute Details
#definition ⇒ Object
The resolved type definition (SimpleType, ComplexType, Element, etc.) Note: This is not serialized in YAML as it’s a complex object reference
23 24 25 |
# File 'lib/lutaml/xml/schema/xsd/type_resolution_result.rb', line 23 def definition @definition end |
Class Method Details
.failure(qname:, error_message:, namespace: nil, local_name: nil, resolution_path: []) ⇒ TypeResolutionResult
Create a failed resolution result
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/lutaml/xml/schema/xsd/type_resolution_result.rb', line 93 def self.failure(qname:, error_message:, namespace: nil, local_name: nil, resolution_path: []) result = new( resolved: false, qname: qname, namespace: namespace, local_name: local_name, schema_file: nil, resolution_path: resolution_path, error_message: , ) # Set definition separately since it's attr_accessor, not attribute result.definition = nil result end |
.success(qname:, namespace:, local_name:, definition:, schema_file:, resolution_path: []) ⇒ TypeResolutionResult
Create a successful resolution result
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/lutaml/xml/schema/xsd/type_resolution_result.rb', line 70 def self.success(qname:, namespace:, local_name:, definition:, schema_file:, resolution_path: []) result = new( resolved: true, qname: qname, namespace: namespace, local_name: local_name, schema_file: schema_file, resolution_path: resolution_path, error_message: nil, ) # Set definition separately since it's attr_accessor, not attribute result.definition = definition result end |
Instance Method Details
#resolved? ⇒ Boolean
Check if the type was successfully resolved
46 47 48 |
# File 'lib/lutaml/xml/schema/xsd/type_resolution_result.rb', line 46 def resolved? resolved == true end |
#type_class ⇒ String?
Get the type class name if definition is available
58 59 60 |
# File 'lib/lutaml/xml/schema/xsd/type_resolution_result.rb', line 58 def type_class definition&.class&.name end |
#type_name ⇒ String?
Get the type name from the definition if available
52 53 54 |
# File 'lib/lutaml/xml/schema/xsd/type_resolution_result.rb', line 52 def type_name definition&.name end |