Class: RbVmomi::VIM::PropertyCollector

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

Instance Method Summary collapse

Instance Method Details

#collectMultiple(objs, *pathSet) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rbvmomi/vim/PropertyCollector.rb', line 2

def collectMultiple objs, *pathSet
  return {} if objs.empty?

  klasses = objs.map{|x| x.class}.uniq 
  klass = if klasses.length > 1
    # common superclass
    klasses.map(&:ancestors).inject(&:&)[0]
  else
    klasses.first
  end

  spec = {
    :objectSet => objs.map{|x| { :obj => x }},
    :propSet => [{
      :pathSet => pathSet,
      :type => klass.wsdl_name
    }]
  }
  res = RetrieveProperties(:specSet => [spec])
  Hash[res.map do |x|
    [x.obj, x.to_hash]
  end]
end