new(p1, p2)
public
Show source
/*
* call-seq:
* WIN32OLE_METHOD.new(ole_type, method) -> WIN32OLE_METHOD object
*
* Returns a new WIN32OLE_METHOD object which represents the information
* about OLE method.
* The first argument <i>ole_type</i> specifies WIN32OLE_TYPE object.
* The second argument <i>method</i> specifies OLE method name defined OLE class
* which represents WIN32OLE_TYPE object.
*
* tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
* method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
*/
static VALUE
folemethod_initialize(self, oletype, method)
VALUE self;
VALUE oletype;
VALUE method;
{
struct oletypedata *ptype;
VALUE obj = Qnil;
if (rb_obj_is_kind_of(oletype, cWIN32OLE_TYPE)) {
Check_SafeStr(method);
Data_Get_Struct(oletype, struct oletypedata, ptype);
obj = olemethod_from_typeinfo(self, ptype->pTypeInfo, method);
if (obj == Qnil) {
rb_raise(eWIN32OLE_RUNTIME_ERROR, "not found %s",
StringValuePtr(method));
}
}
else {
rb_raise(rb_eTypeError, "1st argument should be WIN32OLE_TYPE object");
}
return obj;
}