Method: RbVmomi::VIM::Folder#inventory

Defined in:
lib/rbvmomi/vim/Folder.rb

#inventory(propSpecs = {}) ⇒ Hash

Deprecated.

Efficiently retrieve properties from descendants of this folder.

Parameters:

  • propSpecs (Hash) (defaults to: {})

    Specification of which properties to retrieve from which entities. Keys may be symbols, strings, or classes identifying ManagedEntity subtypes to be included in the results. Values are an array of property paths (strings) or the symbol :all.

Returns:

  • (Hash)

    Tree of inventory items. Folders are hashes from child name to child result. Objects are hashes from property path to value.



203
204
205
206
207
208
209
210
211
212
213
# File 'lib/rbvmomi/vim/Folder.rb', line 203

def inventory propSpecs={}
  inv = inventory_flat propSpecs
  tree = { self => {} }
  inv.each do |obj,x|
    next if obj == self
    h = Hash[x.propSet.map { |y| [y.name, y.val] }]
    tree[h['parent']][h['name']] = [obj, h]
    tree[obj] = {} if obj.is_a? RbVmomi::VIM::Folder
  end
  tree
end