Class: RbVmomi::BasicTypes::ObjectWithProperties

Inherits:
Base
  • Object
show all
Defined in:
lib/rbvmomi/basic_types.rb

Direct Known Subclasses

DataObject, ObjectWithMethods

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

to_s

Class Attribute Details

.props_descObject

Returns the value of attribute props_desc.



30
31
32
# File 'lib/rbvmomi/basic_types.rb', line 30

def props_desc
  @props_desc
end

Class Method Details

.find_prop_desc(name) ⇒ Object



50
51
52
# File 'lib/rbvmomi/basic_types.rb', line 50

def find_prop_desc name
  full_props_desc.find { |x| x['name'] == name.to_s }
end

.full_props_descObject



46
47
48
# File 'lib/rbvmomi/basic_types.rb', line 46

def full_props_desc
  @full_props_desc ||= (self == ObjectWithProperties ? [] : superclass.full_props_desc) + props_desc
end

.full_props_setObject



42
43
44
# File 'lib/rbvmomi/basic_types.rb', line 42

def full_props_set
  @full_props_set ||= Set.new(full_props_desc.map { |x| x['name'] })
end

.init(name = self.name, props = []) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/rbvmomi/basic_types.rb', line 32

def init name=self.name, props=[]
  super name
  @props_desc = props
  @props_desc.each do |d|
    sym = d['name'].to_sym
    define_method(sym) { _get_property sym }
    define_method(:"#{sym}=") { |x| _set_property sym, x }
  end
end

Instance Method Details

#_get_property(sym) ⇒ Object



55
56
57
# File 'lib/rbvmomi/basic_types.rb', line 55

def _get_property sym
  fail 'unimplemented'
end

#_set_property(sym, val) ⇒ Object



59
60
61
# File 'lib/rbvmomi/basic_types.rb', line 59

def _set_property sym, val
  fail 'unimplemented'
end