method_missing(...)
public
Calls <a
href="/ruby/WIN32OLE/invoke">WIN32OLE#invoke</a> method.
Show source
/*
* call-seq:
* WIN32OLE#method_missing(id [,arg1, arg2, ...])
*
* Calls WIN32OLE#invoke method.
*/
static VALUE
fole_missing(argc, argv, self)
int argc;
VALUE *argv;
VALUE self;
{
ID id;
char* mname;
int n;
id = rb_to_id(argv[0]);
mname = rb_id2name(id);
if(!mname) {
rb_raise(rb_eRuntimeError, "fail: unknown method or property");
}
n = strlen(mname);
if(mname[n-1] == '=') {
argv[0] = rb_str_new(mname, n-1);
return ole_propertyput(self, argv[0], argv[1]);
}
else {
argv[0] = rb_str_new2(mname);
return ole_invoke(argc, argv, self, DISPATCH_METHOD|DISPATCH_PROPERTYGET);
}
}