Class: RbVmomi::VIM::DynamicTypeMgrManagedTypeInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/rbvmomi/vim/DynamicTypeMgrManagedTypeInfo.rb

Instance Method Summary collapse

Instance Method Details

#toRbvmomiTypeHashObject


2
3
4
5
6
7
8
9
10
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
39
40
41
42
43
44
45
# File 'lib/rbvmomi/vim/DynamicTypeMgrManagedTypeInfo.rb', line 2

def toRbvmomiTypeHash
  {
    self.wsdlName => {
      'kind' => 'managed',
      'type-id' => self.name,
      'base-type-id' => self.base.first,
      'props' => self.property.map do |prop|
        {
          'name' => prop.name,
          'type-id-ref' => prop.type.gsub("[]", ""),
          'is-array' => (prop.type =~ /\[\]$/) ? true : false,
          'is-optional' => prop.annotation.find{|a| a.name == "optional"} ? true : false,
          'version-id-ref' => prop.version,
        }
      end,
      'methods' => Hash[
        self.method.map do |method|
          result = method.returnTypeInfo

          [method.wsdlName,
           {
             'params' => method.paramTypeInfo.map do |param|
               {
                 'name' => param.name,
                 'type-id-ref' => param.type.gsub("[]", ""),
                 'is-array' => (param.type =~ /\[\]$/) ? true : false,
                 'is-optional' => param.annotation.find{|a| a.name == "optional"} ? true : false,
                 'version-id-ref' => param.version,
               }
             end,
             'result' => {
               'name' => result.name,
               'type-id-ref' => result.type.gsub("[]", ""),
               'is-array' => (result.type =~ /\[\]$/) ? true : false,
               'is-optional' => result.annotation.find{|a| a.name == "optional"} ? true : false,
               'version-id-ref' => result.version,
             }
           }
          ]
        end
      ]
    }
  }
end