Class: RbVmomi::VIM::ObjectWithProperties

Inherits:
Base
  • Object
show all
Defined in:
lib/rbvmomi/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.



111
112
113
# File 'lib/rbvmomi/types.rb', line 111

def props_desc
  @props_desc
end

Class Method Details

.find_prop_desc(name) ⇒ Object



128
129
130
# File 'lib/rbvmomi/types.rb', line 128

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

.full_props_descObject

XXX cache



124
125
126
# File 'lib/rbvmomi/types.rb', line 124

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

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



113
114
115
116
117
118
119
120
121
# File 'lib/rbvmomi/types.rb', line 113

def initialize 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



133
134
135
# File 'lib/rbvmomi/types.rb', line 133

def _get_property sym
  fail 'unimplemented'
end

#_set_property(sym, val) ⇒ Object



137
138
139
# File 'lib/rbvmomi/types.rb', line 137

def _set_property sym, val
  fail 'unimplemented'
end