Class: WIN32OLE_TYPELIB

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

Instance Attribute Summary collapse

Class Method 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(*args) ⇒ WIN32OLE_TYPELIB

Returns a new instance of WIN32OLE_TYPELIB.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/win32ole/win32ole_typelib.rb', line 10

def initialize(*args)
  # TODO: Make this work internally and externally API w/ regards to inargs
  if args.length == 2
    @typelib, @name = *args
    puts "NO TYPELIB! for #{@name} #{@version}" unless @typelib
  elsif args.length == 1
    @name = args[0]
    @typelib = search_registry(@name) # TODO: Missing search_registry2
#      puts "NAME IS #{@name}///#{@typelib}"
  end
end

Instance Attribute Details

#nameObject (readonly) Also known as: to_s

Returns the value of attribute name.



7
8
9
# File 'lib/win32ole/win32ole_typelib.rb', line 7

def name
  @name
end

#typelibObject (readonly)

Returns the value of attribute typelib.



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

def typelib
  @typelib
end

Class Method Details

.ole_classes(typelib) ⇒ Object



57
58
59
# File 'lib/win32ole/win32ole_typelib.rb', line 57

def ole_classes(typelib)
  new(typelib).ole_classes
end

.typelibsObject



61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/win32ole/win32ole_typelib.rb', line 61

def typelibs
  typelibs = []
  typelib_registry_each_guid_version do |guid, version, reg|
    name = reg.read(nil)[1] || ''
    registry_subkey(reg, 'win32', 'win64') do |arch_reg, arch|
      type_lib = load_typelib(arch_reg, arch)
      # TODO: I think MRI figures out a few more typelibs than we do
      typelibs << WIN32OLE_TYPELIB.new(type_lib, name) if type_lib
    end
  end
  typelibs
end

Instance Method Details

#guidObject



22
23
24
# File 'lib/win32ole/win32ole_typelib.rb', line 22

def guid
  @typelib.guid
end

#inspectObject



52
53
54
# File 'lib/win32ole/win32ole_typelib.rb', line 52

def inspect
  name
end

#major_versionObject



30
31
32
# File 'lib/win32ole/win32ole_typelib.rb', line 30

def major_version
  @typelib.major_version
end

#minor_versionObject



26
27
28
# File 'lib/win32ole/win32ole_typelib.rb', line 26

def minor_version
  @typelib.minor_version
end

#ole_classesObject

MRI: ole_types_from_typelib



34
35
36
37
38
39
40
# File 'lib/win32ole/win32ole_typelib.rb', line 34

def ole_classes # MRI: ole_types_from_typelib
  ole_classes = []
  find_all_typeinfo(@typelib) do |info, docs|
    ole_classes << WIN32OLE_TYPE.new(self, info, docs)
  end
  ole_classes
end

#versionObject



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

def version
  [minor_version, major_version].join('.')
end

#visible?Boolean

Returns:

  • (Boolean)


46
47
48
49
50
# File 'lib/win32ole/win32ole_typelib.rb', line 46

def visible?
  flags = @typelib.flags
  flags != 0 && (flags & TypeLib::LIBFLAG_FRESTRICTED) == 0 &&
    (flags & TypeLib::LIBFLAG_FHIDDEN) == 0
end