Class: WIN32OLE_PARAM
Relationships & Source Files | |
Inherits: | Object |
Defined in: | ext/win32ole/win32ole_param.c, ext/win32ole/win32ole_param.c |
Overview
WIN32OLE_PARAM
objects represent param information of the OLE method.
Class Method Summary
-
.new(method, n) ⇒ WIN32OLE_PARAM
constructor
Returns WIN32OLE_PARAM object which represents OLE parameter information.
Instance Attribute Summary
-
#input? ⇒ Boolean
readonly
Returns true if the parameter is input.
-
#optional? ⇒ Boolean
readonly
Returns true if argument is optional.
-
WIN32OLE ⇒ Boolean
readonly
Returns true if argument is output.
-
#retval? ⇒ Boolean
readonly
Returns true if argument is return value.
Instance Method Summary
-
#default
Returns default value.
-
#inspect ⇒ String
Returns the parameter name with class name.
-
#name
Alias for #to_s.
-
#ole_type
Returns OLE type of
WIN32OLE_PARAM
object(parameter of OLE method). -
#ole_type_detail
Returns detail information of type of argument.
-
#to_s
(also: #name)
Returns name.
Constructor Details
.new(method, n) ⇒ WIN32OLE_PARAM
Returns WIN32OLE_PARAM object which represents OLE parameter information. 1st argument should be ::WIN32OLE_METHOD object. 2nd argument `n' is n-th parameter of the method specified by 1st argument.
tobj = WIN32OLE_TYPE.new('Microsoft Scripting Runtime', 'IFileSystem')
method = WIN32OLE_METHOD.new(tobj, 'CreateTextFile')
param = WIN32OLE_PARAM.new(method, 2) # => #<WIN32OLE_PARAM:Overwrite=true>
Instance Attribute Details
#input? ⇒ Boolean
(readonly)
Returns true if the parameter is input.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
param1 = method.params[0]
puts param1.input? # => true
#optional? ⇒ Boolean
(readonly)
Returns true if argument is optional.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
param1 = method.params[0]
puts "#{param1.name} #{param1.optional?}" # => Filename true
WIN32OLE ⇒ Boolean
(readonly)
Returns true if argument is output.
tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'DWebBrowserEvents')
method = WIN32OLE_METHOD.new(tobj, 'NewWindow')
method.params.each do |param|
puts "#{param.name} #{param.output?}"
end
The result of above script is following:
URL false
Flags false
TargetFrameName false
PostData false
Headers false
Processed true
#retval? ⇒ Boolean
(readonly)
Returns true if argument is return value.
tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library',
'DirectPlayLobbyConnection')
method = WIN32OLE_METHOD.new(tobj, 'GetPlayerShortName')
param = method.params[0]
puts "#{param.name} #{param.retval?}" # => name true
Instance Method Details
#default
Returns default value. If the default value does not exist, this method returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
method.params.each do |param|
if param.default
puts "#{param.name} (= #{param.default})"
else
puts "#{param}"
end
end
The above script result is following:
Filename
FileFormat
Password
WriteResPassword
ReadOnlyRecommended
CreateBackup
AccessMode (= 1)
ConflictResolution
AddToMru
TextCodepage
TextVisualLayout
#inspect ⇒ String
Returns the parameter name with class name. If the parameter has default value, then returns name=value string with class name.
#to_s
#name
Alias for #to_s.
#ole_type
Returns OLE type of WIN32OLE_PARAM
object(parameter of OLE method).
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
param1 = method.params[0]
puts param1.ole_type # => VARIANT
#ole_type_detail
Returns detail information of type of argument.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'IWorksheetFunction')
method = WIN32OLE_METHOD.new(tobj, 'SumIf')
param1 = method.params[0]
p param1.ole_type_detail # => ["PTR", "USERDEFINED", "Range"]
#to_s Also known as: #name
Returns name.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE_METHOD.new(tobj, 'SaveAs')
param1 = method.params[0]
puts param1.name # => Filename