rlane/rbvmomi — comment on commit ef02dc80d735af5d61554b23c4ce24d6e7a691f4
File: lib/rbvmomi/vim/Folder.rb line 41
By jeffmccune:

@rlane Hey, I'm studying this section of code looking for an efficient way to reload my server models in Fog.

I'm a bit confused by the case statement. Reading the code I get the impression I should be able to pass a subclass of a ManagedEntity to the inventory method and it will efficiently find those types of ManagedEntities.

My use case is this:

```irb
>> pp vim.rootFolder.inventory(RbVmomi::VIM::VirtualMachine => :all)
RuntimeError: key must be a ManagedEntity
from /vagrant/src/rbvmomi/lib/rbvmomi/vim/Folder.rb:121:in `inventory'
from /vagrant/src/rbvmomi/lib/rbvmomi/vim/Folder.rb:114:in `each'
from /vagrant/src/rbvmomi/lib/rbvmomi/vim/Folder.rb:114:in `inventory'
from (irb):31
from /vagrant/src/fog/bin/fog:40
```

However, that class appears to be a kind of ManagedEntity:

```irb
>> vm = vim.rootFolder.children[0].find_vm("agent_template"); vm.kind_of? RbVmomi::VIM::ManagedEntity
true
```

Does a case statement in ruby automatically do a sort of kind_of? or should this be something like:

```
if k.kind_of? RbVmomi::VIM::ManagedEntity then
...
else
...
end
```