Class: WIN32OLE::Variable
- Inherits:
-
Object
- Object
- WIN32OLE::Variable
- Defined in:
- ext/win32ole/win32ole_variable.c,
ext/win32ole/win32ole_variable.c
Overview
WIN32OLE::Variable
objects represent OLE variable information.
Instance Method Summary collapse
-
#inspect ⇒ String
Returns the OLE variable name and the value with class name.
-
#name ⇒ Object
(also: #to_s)
Returns the name of variable.
-
#ole_type ⇒ Object
Returns OLE type string.
-
#ole_type_detail ⇒ Object
Returns detail information of type.
-
#value ⇒ Object
Returns value if value is exists.
-
#variable_kind ⇒ Object
Returns variable kind string.
-
#varkind ⇒ Object
Returns the number which represents variable kind.
-
#visible? ⇒ Boolean
Returns true if the variable is public.
Instance Method Details
#inspect ⇒ String
Returns the OLE variable name and the value with class name.
359 360 361 362 363 364 365 366 |
# File 'ext/win32ole/win32ole_variable.c', line 359
static VALUE
folevariable_inspect(VALUE self)
{
VALUE v = rb_inspect(folevariable_value(self));
VALUE n = folevariable_name(self);
VALUE detail = rb_sprintf("%"PRIsVALUE"=%"PRIsVALUE, n, v);
return make_inspect("WIN32OLE::Variable", detail);
}
|
#name ⇒ Object Also known as: to_s
Returns the name of variable.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name}"
end
The result of above script is following:
xlChart
xlDialogSheet
xlExcel4IntlMacroSheet
xlExcel4MacroSheet
xlWorksheet
84 85 86 87 88 |
# File 'ext/win32ole/win32ole_variable.c', line 84
static VALUE
folevariable_name(VALUE self)
{
return rb_ivar_get(self, rb_intern("name"));
}
|
#ole_type ⇒ Object
Returns OLE type string.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.ole_type} #{variable.name}"
end
The result of above script is following:
INT xlChart
INT xlDialogSheet
INT xlExcel4IntlMacroSheet
INT xlExcel4MacroSheet
INT xlWorksheet
124 125 126 127 128 129 130 |
# File 'ext/win32ole/win32ole_variable.c', line 124
static VALUE
folevariable_ole_type(VALUE self)
{
struct olevariabledata *pvar;
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
return ole_variable_ole_type(pvar->pTypeInfo, pvar->index);
}
|
#ole_type_detail ⇒ Object
Returns detail information of type. The information is array of type.
tobj = WIN32OLE::Type.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS')
variable = tobj.variables.find {|variable| variable.name == 'lFlags'}
tdetail = variable.ole_type_detail
p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"]
158 159 160 161 162 163 164 |
# File 'ext/win32ole/win32ole_variable.c', line 158
static VALUE
folevariable_ole_type_detail(VALUE self)
{
struct olevariabledata *pvar;
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index);
}
|
#value ⇒ Object
Returns value if value is exists. If the value does not exist, this method returns nil.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name} #{variable.value}"
end
The result of above script is following:
xlChart = -4109
xlDialogSheet = -4116
xlExcel4IntlMacroSheet = 4
xlExcel4MacroSheet = 3
xlWorksheet = -4167
202 203 204 205 206 207 208 |
# File 'ext/win32ole/win32ole_variable.c', line 202
static VALUE
folevariable_value(VALUE self)
{
struct olevariabledata *pvar;
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
return ole_variable_value(pvar->pTypeInfo, pvar->index);
}
|
#variable_kind ⇒ Object
Returns variable kind string.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name} #{variable.variable_kind}"
end
The result of above script is following:
xlChart CONSTANT
xlDialogSheet CONSTANT
xlExcel4IntlMacroSheet CONSTANT
xlExcel4MacroSheet CONSTANT
xlWorksheet CONSTANT
304 305 306 307 308 309 310 |
# File 'ext/win32ole/win32ole_variable.c', line 304
static VALUE
folevariable_variable_kind(VALUE self)
{
struct olevariabledata *pvar;
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
return ole_variable_kind(pvar->pTypeInfo, pvar->index);
}
|
#varkind ⇒ Object
Returns the number which represents variable kind.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name} #{variable.varkind}"
end
The result of above script is following:
xlChart 2
xlDialogSheet 2
xlExcel4IntlMacroSheet 2
xlExcel4MacroSheet 2
xlWorksheet 2
344 345 346 347 348 349 350 |
# File 'ext/win32ole/win32ole_variable.c', line 344
static VALUE
folevariable_varkind(VALUE self)
{
struct olevariabledata *pvar;
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
return ole_variable_varkind(pvar->pTypeInfo, pvar->index);
}
|
#visible? ⇒ Boolean
Returns true if the variable is public.
tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name} #{variable.visible?}"
end
The result of above script is following:
xlChart true
xlDialogSheet true
xlExcel4IntlMacroSheet true
xlExcel4MacroSheet true
xlWorksheet true
248 249 250 251 252 253 254 |
# File 'ext/win32ole/win32ole_variable.c', line 248
static VALUE
folevariable_visible(VALUE self)
{
struct olevariabledata *pvar;
TypedData_Get_Struct(self, struct olevariabledata, &olevariable_datatype, pvar);
return ole_variable_visible(pvar->pTypeInfo, pvar->index);
}
|