Class: Cmpi::CMPIObjectPath

Inherits:
Object
  • Object
show all
Defined in:
lib/cmpi.rb,
ext/cmpi-bindings/cmpi_wrap.c

Overview

Proxy of C Cmpi::CMPIObjectPath struct

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

Allow Ref.Property and Ref.Property=



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/cmpi.rb', line 364

def method_missing name, *args
  s = name.to_s
  if s =~ /=$/
	v = args[0]
	n = s.chop
	# -> http://blog.sidu.in/2008/02/loading-classes-from-strings-in-ruby.html
    unless @typemap
      begin
        @typemap = Cmpi.const_get(self.classname).typemap
      rescue NameError
        raise "Cmpi::#{self.classname}.typemap not defined"
      end
    end
	t = @typemap[n]
    raise "Property '#{n}' of Cmpi::#{self.classname}.typemap not defined" unless t
#        STDERR.printf "ObjectPath.%s = %s[%s]:%04x\n" % [n, v, v.class, t]
    self[n,v] = t
  else
#	STDERR.puts "CMPIObjectPath.#{name} -> #{self[s].inspect}"
	self[s]
  end
end

Instance Attribute Details

#typemapObject

Returns the value of attribute typemap.



360
361
362
# File 'lib/cmpi.rb', line 360

def typemap
  @typemap
end