File: collisions.rb

package info (click to toggle)
ruby-rbvmomi 1.8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,756 kB
  • sloc: ruby: 5,590; sh: 36; makefile: 7
file content (18 lines) | stat: -rw-r--r-- 613 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby
# Find collisions between VMODL property names and Ruby methods
require 'rbvmomi'
VIM = RbVmomi::VIM

conn = VIM.new(:ns => 'urn:vim25', :rev => '4.0')

VIM.loader.typenames.each do |name|
  klass = VIM.loader.get name
  next unless klass.respond_to? :kind and [:managed, :data].member? klass.kind
  methods = klass.kind == :managed ?
    RbVmomi::BasicTypes::ObjectWithMethods.instance_methods : 
    RbVmomi::BasicTypes::ObjectWithProperties.instance_methods
  klass.props_desc.each do |x|
    name = x['name']
    puts "collision: #{klass}##{name}" if methods.member? name.to_sym
  end
end