Class: RbVmomi::VIM::ManagedEntity
- Inherits:
-
Object
- Object
- RbVmomi::VIM::ManagedEntity
- Defined in:
- lib/rbvmomi/vim/ManagedEntity.rb
Instance Method Summary collapse
-
#path ⇒ Array
Retrieve the ancestors of the entity.
-
#pretty_path ⇒ String
Return a string representation of
path
suitable for display.
Instance Method Details
#path ⇒ Array
Retrieve the ancestors of the entity.
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 |
# File 'lib/rbvmomi/vim/ManagedEntity.rb', line 4 def path filterSpec = RbVmomi::VIM.PropertyFilterSpec( :objectSet => [{ :obj => self, :selectSet => [ RbVmomi::VIM.TraversalSpec( :name => 'tsME', :type => 'ManagedEntity', :path => 'parent', :skip => false, :selectSet => [ RbVmomi::VIM.SelectionSpec(:name => 'tsME') ] ) ] }], :propSet => [{ :pathSet => %w(name parent), :type => 'ManagedEntity' }] ) result = @soap.propertyCollector.RetrieveProperties(:specSet => [filterSpec]) tree = {} result.each { |x| tree[x.obj] = [x['parent'], x['name']] } a = [] cur = self while cur parent, name = *tree[cur] a << [cur, name] cur = parent end a.reverse end |
#pretty_path ⇒ String
Return a string representation of path
suitable for display.
43 44 45 |
# File 'lib/rbvmomi/vim/ManagedEntity.rb', line 43 def pretty_path path[1..-1].map { |x| x[1] } * '/' end |