Class: Lutaml::Xml::Schema::Xsd::Choice
- Inherits:
-
Base
- Object
- Model::Serializable
- Base
- Lutaml::Xml::Schema::Xsd::Choice
- Defined in:
- lib/lutaml/xml/schema/xsd/choice.rb
Constant Summary
Constants inherited from Base
Base::ELEMENT_ORDER_IGNORABLE, Base::XML_DECLARATION_REGEX
Constants included from Model::Serialize
Model::Serialize::DEFAULT_VALUE_MAP, Model::Serialize::INTERNAL_ATTRIBUTES, Model::Serialize::LAZY_EMPTY_COLLECTION
Instance Attribute Summary
Attributes included from Model::Serialize
#lutaml_parent, #lutaml_register, #lutaml_root
Instance Method Summary collapse
-
#child_elements(array = []) ⇒ Object
Walk the choice recursively and collect contained element nodes.
-
#find_elements_used(element_name) ⇒ Object
Check whether the choice references a given element name in any nested branch.
Methods inherited from Base
#all?, #annotation?, #any?, #assign_root!, #attribute?, #attribute_group?, #choice?, #complex_content?, #element?, #max_occurrences, #min_occurrences, #resolved_element_order, #sequence?, #simple_content?, #target_prefix, #to_formatted_xml, #unresolvable_items
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 Method Details
#child_elements(array = []) ⇒ Object
Walk the choice recursively and collect contained element nodes.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/lutaml/xml/schema/xsd/choice.rb', line 40 def child_elements(array = []) resolved_element_order&.each do |child| if child.is_a?(Element) array << child elsif child.respond_to?(:child_elements) child.child_elements(array) end end array end |
#find_elements_used(element_name) ⇒ Object
Check whether the choice references a given element name in any nested branch.
53 54 55 56 57 58 59 60 61 |
# File 'lib/lutaml/xml/schema/xsd/choice.rb', line 53 def find_elements_used(element_name) resolved_element_order&.any? do |child| if child.is_a?(Element) reference_matches?(element_name, child.ref || child.name) elsif child.respond_to?(:find_elements_used) child.find_elements_used(element_name) end end || false end |