Class: WIN32OLE_METHOD
Instance Attribute Summary collapse
Instance Method Summary
collapse
#SafeStringValue, #WIN32OLE_TYPEValue, #all_methods, #all_vars, #find_all_methods_in, #find_all_typeinfo, #load_typelib, #methods_with_flag, #reg_each_key_for, #registry_subkey, #search_registry, #typedesc_value, #typeinfo_from_ole, #typelib_registry_each_guid_version
Constructor Details
Returns a new instance of WIN32OLE_METHOD.
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/win32ole/win32ole_method.rb', line 7
def initialize(*args)
if args.length == 6 @oletype, @typeinfo, @owner_typeinfo, @desc, @docs, @index = *args
elsif args.length == 2 @oletype, name = WIN32OLE_TYPEValue(args[0]), SafeStringValue(args[1])
all_methods(@oletype.typeinfo) do |ti, oti, desc, docs, index|
if docs.name.downcase == name.downcase
@typeinfo, @owner_typeinfo, @desc, @docs, @index = ti, oti, desc, docs, index
break;
end
end
raise WIN32OLERuntimeError.new "not found: #{name}" if !@typeinfo
else raise ArgumentError.new("2 for #{args.length}")
end
end
|
Instance Attribute Details
#oletype ⇒ Object
Returns the value of attribute oletype.
5
6
7
|
# File 'lib/win32ole/win32ole_method.rb', line 5
def oletype
@oletype
end
|
#typeinfo ⇒ Object
Returns the value of attribute typeinfo.
5
6
7
|
# File 'lib/win32ole/win32ole_method.rb', line 5
def typeinfo
@typeinfo
end
|
Instance Method Details
#dispid ⇒ Object
25
26
27
|
# File 'lib/win32ole/win32ole_method.rb', line 25
def dispid
@desc.memid
end
|
#event? ⇒ Boolean
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/win32ole/win32ole_method.rb', line 29
def event?
return false if @owner_typeinfo.typekind != TypeInfo::TYPEKIND_COCLASS
@owner_typeinfo.impl_types_count.times do |i|
begin
flags = @owner_typeinfo.get_impl_type_flags(i)
if flags & TypeInfo::IMPLTYPEFLAG_FSOURCE
href = @owner_typeinfo.get_ref_type_of_impl_type(i)
ref_typeinfo = @owner_typeinfo.get_ref_type_info(href)
func_desc = ref_typeinfo.func_desc(@index)
documentation = ref_typeinfo.documentation(func_desc.memid)
return true if documentation.name == name
end
rescue ComFailException => e
end
end
false
end
|
#event_interface ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/win32ole/win32ole_method.rb', line 50
def event_interface
return nil unless event?
typelib = @typeinfo.containing_type_lib
documentation = typelib.documentation(typelib.index)
documentation.name
end
|
#helpcontext ⇒ Object
58
59
60
|
# File 'lib/win32ole/win32ole_method.rb', line 58
def helpcontext
@docs.help_context
end
|
#helpfile ⇒ Object
66
67
68
|
# File 'lib/win32ole/win32ole_method.rb', line 66
def helpfile
@docs.help_file
end
|
#helpstring ⇒ Object
62
63
64
|
# File 'lib/win32ole/win32ole_method.rb', line 62
def helpstring
@docs.doc_string
end
|
#inspect ⇒ Object
133
134
135
|
# File 'lib/win32ole/win32ole_method.rb', line 133
def inspect
name
end
|
#invkind ⇒ Object
70
71
72
|
# File 'lib/win32ole/win32ole_method.rb', line 70
def invkind
@desc.invkind
end
|
#invoke_kind ⇒ Object
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/win32ole/win32ole_method.rb', line 74
def invoke_kind
invkind = @desc.invkind
if invkind & Dispatch::Get && invkind & Dispatch::Put
return "PROPERTY"
elsif invkind & Dispatch::Get
return "PROPERTYGET"
elsif invkind & Dispatch::Put
return "PROPERTYPUT"
elsif invkind & Dispatch::PutRef
return "PROPERTYPUTREF"
elsif invkind & Dispatch::Method
return "FUNC"
else
return "UNKOWN"
end
end
|
#name ⇒ Object
Also known as:
to_s
91
92
93
|
# File 'lib/win32ole/win32ole_method.rb', line 91
def name
@docs.name
end
|
#offset_vtbl ⇒ Object
96
97
98
|
# File 'lib/win32ole/win32ole_method.rb', line 96
def offset_vtbl
@desc.vtable_offset
end
|
#params ⇒ Object
100
101
102
103
104
105
106
|
# File 'lib/win32ole/win32ole_method.rb', line 100
def params
arr = []
@desc.parameters.to_a.each_with_index do |param, i|
arr << WIN32OLE_PARAM.new(self, i, param)
end
arr
end
|
#return_type ⇒ Object
108
109
110
|
# File 'lib/win32ole/win32ole_method.rb', line 108
def return_type
typedesc_value(@desc.return_type.vt)
end
|
#return_type_detail ⇒ Object
112
113
114
|
# File 'lib/win32ole/win32ole_method.rb', line 112
def return_type_detail
typedesc_value(@desc.return_type.vt, [])
end
|
#return_vtype ⇒ Object
116
117
118
|
# File 'lib/win32ole/win32ole_method.rb', line 116
def return_vtype
@desc.return_type.vt
end
|
#size_opt_params ⇒ Object
120
121
122
|
# File 'lib/win32ole/win32ole_method.rb', line 120
def size_opt_params
@desc.opt_params_count
end
|
#size_params ⇒ Object
124
125
126
|
# File 'lib/win32ole/win32ole_method.rb', line 124
def size_params
@desc.params_count
end
|
#visible? ⇒ Boolean
128
129
130
131
|
# File 'lib/win32ole/win32ole_method.rb', line 128
def visible?
(@desc.flags & (FuncDesc::FUNCFLAG_FRESTRICTED | FuncDesc::FUNCFLAG_FHIDDEN |
FuncDesc::FUNCFLAG_FNONBROWSABLE)) == 0
end
|