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.



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

def props_desc
  @props_desc
end

Class Method Details

.find_prop_desc(name) ⇒ Object



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

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

.full_props_descObject



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

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

.full_props_setObject



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

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

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



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

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



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

def _get_property sym
  raise 'unimplemented'
end

#_set_property(sym, val) ⇒ Object



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

def _set_property sym, val
  raise 'unimplemented'
end