Module: OleHelper

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

Instance Method Summary collapse

Instance Method Details

#create_ole_type(type) ⇒ Object



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

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

#each_ole_typeObject



69
70
71
72
73
74
# File 'lib/microstation/ole_helper.rb', line 69

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



76
77
78
79
80
81
82
83
84
# File 'lib/microstation/ole_helper.rb', line 76

def get_ole_type(name)
  if name.class == 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



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

def ole_classes
  typelib.ole_classes
end

#ole_classes_detailObject



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

def ole_classes_detail
  s = String.new
  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



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

def ole_methods_detail
  s = String.new
  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



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

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

#select_ole_type(name) ⇒ Object



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

def select_ole_type(name)
  if name.class == 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



86
87
88
# File 'lib/microstation/ole_helper.rb', line 86

def typelib
  self.ole_typelib
end