Class: XSD::Union

Inherits:
BaseObject show all
Defined in:
lib/xsd/objects/union.rb,
sig/xsd.rbs,
sig/xsd_members.rbs

Overview

The union element defines a simple type as a collection (union) of values from specified simple data types. Parent elements: simpleType https://www.w3schools.com/xml/el_union.asp

Constant Summary

Constants inherited from BaseObject

BaseObject::NOT_A_MEMBER, BaseObject::NO_ATTRIBUTES_CONTAINER, BaseObject::NO_ELEMENTS_CONTAINER, BaseObject::XML_SCHEMA, BaseObject::XML_SCHEMA_NS

Instance Attribute Summary collapse

Attributes inherited from BaseObject

#id, #options

Instance Method Summary collapse

Methods inherited from BaseObject

#[], child, #collect_attributes, #collect_elements, define_member_reader, #documentation, #documentation_for, #get_prefix, #initialize, #inspect, link, #map_child, #map_children, mapped_name, member_readers, #method_missing, #namespaces, #nil_if_empty, #node, #node_to_object, #nodes, #object_by_name, #parent, property, #read_member, #reader, #respond_to_missing?, #schema, #schemas_for_namespace, #strip_prefix, to_underscore

Constructor Details

This class inherits a constructor from XSD::BaseObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class XSD::BaseObject

Instance Attribute Details

#member_types ⇒ Array[untyped]

Optional. Specifies a list of built-in data types or simpleType elements defined in a schema

Returns:

  • (Array[untyped])


11
12
13
# File 'lib/xsd/objects/union.rb', line 11

property :memberTypes, :array, default: [] do |union|
  union.node['memberTypes']&.split
end

Instance Method Details

#types ⇒ Object

Nested simple and built-in types

Returns:

  • (Object)


17
18
19
20
21
# File 'lib/xsd/objects/union.rb', line 17

def types
  @types ||= map_children(:simpleType) + member_types.map do |name|
    object_by_name(:simpleType, name) || name
  end
end