Class: WIN32OLE::Method
Relationships & Source Files | |
Inherits: | Object |
Defined in: | ext/win32ole/win32ole_method.c, ext/win32ole/win32ole_method.c |
Overview
Method
objects represent OLE method information.
Class Method Summary
-
.new(ole_type, method) ⇒ Method
constructor
Returns a new
Method
object which represents the information about OLE method.
Instance Attribute Summary
-
#event? ⇒ Boolean
readonly
Returns true if the method is event.
-
#visible? ⇒ Boolean
readonly
Returns true if the method is public.
Instance Method Summary
-
#dispid
Returns dispatch ID.
-
#event_interface
Returns event interface name if the method is event.
-
#helpcontext
Returns help context.
-
#helpfile
Returns help file.
-
#helpstring
Returns help string of OLE method.
-
#inspect ⇒ String
Returns the method name with class name.
-
#invkind
Returns the method invoke kind.
-
#invoke_kind
Returns the method kind string.
-
#name
Alias for #to_s.
-
#offset_vtbl
Returns the offset ov VTBL.
-
#params
returns array of
Param
object corresponding with method parameters. -
#return_type
Returns string of return value type of method.
-
#return_type_detail
Returns detail information of return value type of method.
-
#return_vtype
Returns number of return value type of method.
-
#size_opt_params
Returns the size of optional parameters.
-
#size_params
Returns the size of arguments of the method.
-
#to_s
(also: #name)
Returns the name of the method.
Constructor Details
.new(ole_type, method) ⇒ Method
Returns a new Method
object which represents the information about OLE method. The first argument ole_type specifies Type
object. The second argument method specifies OLE method name defined OLE class which represents Type
object.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SaveAs')
# File 'ext/win32ole/win32ole_method.c', line 265
static VALUE folemethod_initialize(VALUE self, VALUE oletype, VALUE method) { VALUE obj = Qnil; ITypeInfo *pTypeInfo; if (rb_obj_is_kind_of(oletype, cWIN32OLE_TYPE)) { SafeStringValue(method); pTypeInfo = itypeinfo(oletype); obj = olemethod_from_typeinfo(self, pTypeInfo, method); if (obj == Qnil) { rb_raise(eWIN32OLERuntimeError, "not found %s", StringValuePtr(method)); } } else { rb_raise(rb_eTypeError, "1st argument should be WIN32OLE::Type object"); } return obj; }
Instance Attribute Details
#event? ⇒ Boolean
(readonly)
# File 'ext/win32ole/win32ole_method.c', line 586
static VALUE folemethod_event(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); if (!pmethod->pOwnerTypeInfo) return Qfalse; return ole_method_event(pmethod->pOwnerTypeInfo, pmethod->index, rb_ivar_get(self, rb_intern("name"))); }
#visible? ⇒ Boolean
(readonly)
# File 'ext/win32ole/win32ole_method.c', line 504
static VALUE folemethod_visible(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_visible(pmethod->pTypeInfo, pmethod->index); }
Instance Method Details
#dispid
# File 'ext/win32ole/win32ole_method.c', line 758
static VALUE folemethod_dispid(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_dispid(pmethod->pTypeInfo, pmethod->index); }
#event_interface
# File 'ext/win32ole/win32ole_method.c', line 607
static VALUE folemethod_event_interface(VALUE self) { BSTR name; struct olemethoddata *pmethod; HRESULT hr; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); if(folemethod_event(self) == Qtrue) { hr = ole_docinfo_from_type(pmethod->pTypeInfo, &name, NULL, NULL, NULL); if(SUCCEEDED(hr)) return WC2VSTR(name); } return Qnil; }
#helpcontext
# File 'ext/win32ole/win32ole_method.c', line 727
static VALUE folemethod_helpcontext(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_helpcontext(pmethod->pTypeInfo, pmethod->index); }
#helpfile
# File 'ext/win32ole/win32ole_method.c', line 697
static VALUE folemethod_helpfile(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_helpfile(pmethod->pTypeInfo, pmethod->index); }
#helpstring
# File 'ext/win32ole/win32ole_method.c', line 667
static VALUE folemethod_helpstring(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_helpstring(pmethod->pTypeInfo, pmethod->index); }
#inspect ⇒ String
Returns the method name with class name.
# File 'ext/win32ole/win32ole_method.c', line 920
static VALUE folemethod_inspect(VALUE self) { return default_inspect(self, "WIN32OLE::Method"); }
#invkind
# File 'ext/win32ole/win32ole_method.c', line 448
static VALUE folemethod_invkind(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_invkind(pmethod->pTypeInfo, pmethod->index); }
#invoke_kind
Returns the method kind string. The string is “UNKNOWN” or “PROPERTY” or “PROPERTY” or “PROPERTYGET” or “PROPERTYPUT” or “PROPERTYPPUTREF” or “FUNC”.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.invoke_kind # => "FUNC"
# File 'ext/win32ole/win32ole_method.c', line 467
static VALUE folemethod_invoke_kind(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_invoke_kind(pmethod->pTypeInfo, pmethod->index); }
#to_s
#name
Alias for #to_s.
#offset_vtbl
# File 'ext/win32ole/win32ole_method.c', line 789
static VALUE folemethod_offset_vtbl(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_offset_vtbl(pmethod->pTypeInfo, pmethod->index); }
#params
returns array of Param
object corresponding with method parameters.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SaveAs')
p method.params # => [Filename, FileFormat, Password, WriteResPassword,
ReadOnlyRecommended, CreateBackup, AccessMode,
ConflictResolution, AddToMru, TextCodepage,
TextVisualLayout]
# File 'ext/win32ole/win32ole_method.c', line 905
static VALUE folemethod_params(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_params(pmethod->pTypeInfo, pmethod->index); }
#return_type
# File 'ext/win32ole/win32ole_method.c', line 328
static VALUE folemethod_return_type(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_return_type(pmethod->pTypeInfo, pmethod->index); }
#return_type_detail
# File 'ext/win32ole/win32ole_method.c', line 396
static VALUE folemethod_return_type_detail(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_return_type_detail(pmethod->pTypeInfo, pmethod->index); }
#return_vtype
# File 'ext/win32ole/win32ole_method.c', line 362
static VALUE folemethod_return_vtype(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_return_vtype(pmethod->pTypeInfo, pmethod->index); }
#size_opt_params
# File 'ext/win32ole/win32ole_method.c', line 852
static VALUE folemethod_size_opt_params(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_size_opt_params(pmethod->pTypeInfo, pmethod->index); }
#size_params
# File 'ext/win32ole/win32ole_method.c', line 821
static VALUE folemethod_size_params(VALUE self) { struct olemethoddata *pmethod; TypedData_Get_Struct(self, struct olemethoddata, &olemethod_datatype, pmethod); return ole_method_size_params(pmethod->pTypeInfo, pmethod->index); }
#to_s Also known as: #name
# File 'ext/win32ole/win32ole_method.c', line 296
static VALUE folemethod_name(VALUE self) { return rb_ivar_get(self, rb_intern("name")); }