Module: OleHelper

Included in:
WIN32OLE
Defined in:
lib/microstation/ole_helper.rb

Instance Method Summary collapse

Instance Method Details

#create_ole_type(type) ⇒ Object



26
27
28
# File 'lib/microstation/ole_helper.rb', line 26

def create_ole_type(type)
  WIN32OLE.new(type.guid)
end

#each_ole_typeObject



66
67
68
69
70
71
# File 'lib/microstation/ole_helper.rb', line 66

def each_ole_type
  return enum_for(:each_ole_type) unless block_given?
  typelib.ole_classes.each do |t|
    yield t
  end
end

#get_ole_type(name) ⇒ Object



73
74
75
76
77
78
79
80
81
# File 'lib/microstation/ole_helper.rb', line 73

def get_ole_type(name)
  if name.instance_of?(String)
    return ole_classes.find { |t| t.name == name }
  end
  reg = Regexp.new(name.source, Regexp::IGNORECASE)
  ole_classes.find do |t|
    t.name =~ name
  end
end

#ole_classesObject



22
23
24
# File 'lib/microstation/ole_helper.rb', line 22

def ole_classes
  typelib.ole_classes
end

#ole_classes_detailObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/microstation/ole_helper.rb', line 30

def ole_classes_detail
  s = ""
  ole_classes.sort_by { |k| k.ole_type }.each do |k|
    s << "#{k.name}\n\n"
    s << "Type: #{k.ole_type}\n"
    s << "progid: #{k.progid}\n"
    s << "quid: #{k.guid}\n"
    s << "------------\n\n"
  end
  s
end

#ole_methods_detailObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/microstation/ole_helper.rb', line 42

def ole_methods_detail
  s = ""
  ole_methods.each do |m|
    s << "Method #{m.name}\n\n"
    s << "dispid: #{m.dispid}\n"
    s << "Event? #{m.event?}\n"
    s << "Event interface: #{m.event_interface}\n"
    s << "invoke kind: #{m.invoke_kind}\n"
    s << "return type: #{m.return_type_detail}\n"
    s << "visible: #{m.visible?}\n"
    s << "params...\n"
    m.params.each do |p|
      s << "Param Name: #{p.name}\n"
      s << "Optional: #{p.optional?}\n"
      s << "Output? #{p.output?}\n"
      s << "Detail\n"
      s << "#{p.ole_type_detail}"
      s << "\n\n"
    end
    s << "------------\n\n"
  end
  s
end

#select_ole_method(name) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/microstation/ole_helper.rb', line 12

def select_ole_method(name)
  if name.instance_of?(String)
    name = Regexp.new(name)
  end
  reg = Regexp.new(name.source, Regexp::IGNORECASE)
  ole_methods.select do |k|
    reg =~ k.name
  end
end

#select_ole_type(name) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/microstation/ole_helper.rb', line 2

def select_ole_type(name)
  if name.instance_of?(String)
    name = Regexp.new(name)
  end
  reg = Regexp.new(name.source, Regexp::IGNORECASE)
  typelib.ole_classes.select do |k|
    reg =~ k.name
  end
end

#typelibObject



83
84
85
# File 'lib/microstation/ole_helper.rb', line 83

def typelib
  ole_typelib
end