class RbVmomi::VMODL

Utility class for VMware Managed Object Designed Language

@author J.R. Garcia <jrg@vmware.com> @since 2.0.1

Attributes

file[RW]

Public Class Methods

from_file(file = '') click to toggle source

Create a VMODL object from a marshaled file

@author J.R. Garcia <jrg@vmware.com>

@since 2.0.1

@param [String] file the path to create the VMODL object from

@return [VMODL] the created VMODL

# File lib/rbvmomi/vmodl.rb, line 18
def self.from_file(file = '')
  raise ArgumentError, "'#{file}' doesn't exist" unless File.exist?(file)
  new.tap { |o| o.instance_variable_set(:@file, file) }
end

Public Instance Methods

diff(other) click to toggle source

Diff this VMODL with another VMODL

@author J.R. Garcia <jrg@vmware.com>

@since 2.0.1

@return a diff of the VMODLs

# File lib/rbvmomi/vmodl.rb, line 41
def diff(other)
  HashDiff.diff(self.to_h, other.to_h)
end
to_h() click to toggle source

Translate a VMODL object to a Hash

@author J.R. Garcia <jrg@vmware.com>

@since 2.0.1

@return [Hash] a Hash representation of the VMODL

# File lib/rbvmomi/vmodl.rb, line 30
def to_h
  Marshal.load(IO.read(@file))
end