method_missing(*args)
public
Show source
static VALUE
fole_missing(int argc, VALUE *argv, VALUE self)
{
ID id;
const char* mname;
size_t n;
rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
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 (n >= LONG_MAX) {
rb_raise(rb_eRuntimeError, "too long method or property name");
}
if(mname[n-1] == '=') {
rb_check_arity(argc, 2, 2);
argv[0] = rb_enc_str_new(mname, (long)(n-1), cWIN32OLE_enc);
return ole_propertyput(self, argv[0], argv[1]);
}
else {
argv[0] = rb_enc_str_new(mname, (long)n, cWIN32OLE_enc);
return ole_invoke(argc, argv, self, DISPATCH_METHOD|DISPATCH_PROPERTYGET, FALSE);
}
}