Module: Dcc::Si::Base::Hybrid

Included in:
V1::Hybrid, V2::Hybrid
Defined in:
lib/dcc/si/base/hybrid.rb

Overview

si:hybridType — multi-unit adapter. Wraps one or more quantity representations (real, realListXMLList, complex, etc.) that express the same measurand in different units. At least one SI unit is required per the XSD.

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



11
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
# File 'lib/dcc/si/base/hybrid.rb', line 11

def self.included(klass)
  klass.class_eval do
    attribute :id, :string
    attribute :ref_type, :string
    attribute :label, :string
    attribute :quantity_type, :string
    attribute :real, :real, collection: true
    attribute :complex, :complex, collection: true
    attribute :constant, :constant, collection: true
    attribute :real_list_xml_list, :realListXMLList, collection: true
    attribute :complex_list_xml_list, :complexListXMLList, collection: true

    xml do
      namespace ::Dcc::Namespace::Si
      element "hybrid"
      ordered
      map_attribute "id", to: :id
      map_attribute "refType", to: :ref_type
      map_element "label", to: :label
      map_element "quantityType", to: :quantity_type
      map_element "real", to: :real
      map_element "complex", to: :complex
      map_element "constant", to: :constant
      map_element "realListXMLList", to: :real_list_xml_list
      map_element "complexListXMLList", to: :complex_list_xml_list
    end
  end
end