Class: WIN32OLE_VARIABLE

Inherits:
Object
  • Object
show all
Includes:
WIN32OLE::Utils
Defined in:
lib/win32ole/win32ole_variable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from WIN32OLE::Utils

#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

#initialize(type, var_desc, name) ⇒ WIN32OLE_VARIABLE

Returns a new instance of WIN32OLE_VARIABLE.



6
7
8
# File 'lib/win32ole/win32ole_variable.rb', line 6

def initialize(type, var_desc, name)
  @type, @var_desc, @name = type, var_desc, name
end

Instance Attribute Details

#nameObject (readonly) Also known as: to_s

Returns the value of attribute name.



4
5
6
# File 'lib/win32ole/win32ole_variable.rb', line 4

def name
  @name
end

Instance Method Details

#inspectObject



42
43
44
# File 'lib/win32ole/win32ole_variable.rb', line 42

def inspect
  "#<WIN32OLE_VARIABLE:#{to_s}=#{value.inspect}>"
end

#ole_typeObject



10
11
12
# File 'lib/win32ole/win32ole_variable.rb', line 10

def ole_type
  @type.ole_type # MRI gets from vardesc, but why shouldn't this work?
end

#ole_type_detailObject



14
15
16
17
# File 'lib/win32ole/win32ole_variable.rb', line 14

def ole_type_detail
  # TODO: Fill in other details when they actually exist
  [@type.ole_type]
end

#valueObject



19
20
21
# File 'lib/win32ole/win32ole_variable.rb', line 19

def value
  RubyWIN32OLE.from_variant(JRuby.runtime, @var_desc.constant)
end

#variable_kindObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/win32ole/win32ole_variable.rb', line 23

def variable_kind
  case varkind
  when VarDesc::VAR_PERINSTANCE then
    "PERINSTANCE"
  when VarDesc::VAR_STATIC then
    "STATIC"
  when VarDesc::VAR_CONST then
    "CONSTANT"
  when VarDesc::VAR_DISPATCH then
    "DISPATCH"
  else
    "UNKNOWN"
  end
end

#varkindObject



38
39
40
# File 'lib/win32ole/win32ole_variable.rb', line 38

def varkind
  @var_desc.varkind
end

#visible?Boolean

Returns:

  • (Boolean)


48
49
50
51
# File 'lib/win32ole/win32ole_variable.rb', line 48

def visible?
  flags = @var_desc.flags
  flags & (VarDesc::VARFLAG_FHIDDEN | VarDesc::VARFLAG_FRESTRICTED | VarDesc::VARFLAG_FNONBROWSABLE) == 0
end