Module: Dcc::Base::Data

Included in:
V2::Data, V3::Data
Defined in:
lib/dcc/base/data.rb

Overview

dcc:dataType — the central xs:choice container. May hold any of: text, formula, byteData, xml, quantity, list. The XSD allows maxOccurs="unbounded" so any of the alternatives may repeat.

We model each branch as a collection attribute; the version wrapper resolves quantity to the version-appropriate D-SI-aware type.

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/dcc/base/data.rb', line 12

def self.included(klass)
  klass.class_eval do
    attribute :id, :string
    attribute :ref_id, :string
    attribute :ref_type, :string
    attribute :text, :text, collection: true
    attribute :formula, :formula, collection: true
    attribute :byte_data, :byteData, collection: true
    attribute :xml, :xml, collection: true
    attribute :quantity, :quantity, collection: true
    attribute :list, :list, collection: true

    xml do
      namespace ::Dcc::Namespace::Dcc
      element "data"
      ordered
      map_attribute "id", to: :id
      map_attribute "refId", to: :ref_id
      map_attribute "refType", to: :ref_type
      map_element "text", to: :text
      map_element "formula", to: :formula
      map_element "byteData", to: :byte_data
      map_element "xml", to: :xml
      map_element "quantity", to: :quantity
      map_element "list", to: :list
    end
  end
end