Class: XSD::Union

Inherits:
BaseObject show all
Defined in:
lib/xsd/objects/union.rb

Overview

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

Constant Summary

Constants inherited from BaseObject

BaseObject::NO_ATTRIBUTES_CONTAINER, BaseObject::NO_ELEMENTS_CONTAINER, BaseObject::XML_SCHEMA

Instance Attribute Summary collapse

Attributes inherited from BaseObject

#id, #options

Instance Method Summary collapse

Methods inherited from BaseObject

#[], #collect_attributes, #collect_elements, #documentation, #documentation_for, #get_prefix, #initialize, #inspect, #map_child, #map_children, #namespaces, #node, #node_to_object, #nodes, #object_by_name, #parent, #reader, #schema, #schemas_for_namespace, #strip_prefix

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_typesObject

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



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

#typesObject

Nested simple and built-in types



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