Method: WIN32OLE::Record#ole_instance_variable_get
- Defined in:
- win32ole_record.c
#ole_instance_variable_get(name) ⇒ Object
Returns value specified by the member name of VT_RECORD OLE object. If the member name is not correct, KeyError exception is raised. If you can’t access member variable of VT_RECORD OLE object directly, use this method.
If COM server in VB.NET ComServer project is the following:
Imports System.Runtime.InteropServices
Public Class ComClass
Public Structure ComObject
Public object_id As Ineger
End Structure
End Class
and Ruby Object class has title attribute:
then accessing object_id of ComObject from Ruby is as the following:
srver = WIN32OLE.new('ComServer.ComClass')
obj = WIN32OLE::Record.new('ComObject', server)
# obj.object_id returns Ruby Object#object_id
obj.ole_instance_variable_get(:object_id) # => nil
502 503 504 505 506 507 508 509 510 511 512 513 514 |
# File 'win32ole_record.c', line 502
static VALUE
folerecord_ole_instance_variable_get(VALUE self, VALUE name)
{
VALUE sname;
if(!RB_TYPE_P(name, T_STRING) && !RB_TYPE_P(name, T_SYMBOL)) {
rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)");
}
sname = name;
if (RB_TYPE_P(name, T_SYMBOL)) {
sname = rb_sym2str(name);
}
return olerecord_ivar_get(self, sname);
}
|