Class: P2::Library

Inherits:
WIN32OLE_TYPELIB show all
Includes:
P2
Defined in:
lib/p2ruby/library.rb

Overview

Represents P2ClientGate OLE type library. Only works with STA version ( Ruby WIN32OLE limitation ).

Constant Summary

Constants included from P2

VERSION, VERSION_FILE

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WIN32OLE_TYPELIB

#guid, #inspect, #library_name, #major_version, make_version_str, #minor_version, #name, #ole_types, #oletypelib2itypelib, #oletypelib_path, oletypelib_search_registry, oletypelib_search_registry2, #oletypelib_set_member, #path, reg_enum_key, reg_get_typelib_file_path, reg_get_val, reg_get_val2, reg_open_key, reg_open_vkey, typelib_file, typelib_file_from_clsid, typelib_file_from_typelib, typelibs, #version, #visible?

Constructor Details

#initializeLibrary

Returns a new instance of Library.



13
14
15
16
17
# File 'lib/p2ruby/library.rb', line 13

def initialize
  p2lib = WIN32OLE_TYPELIB.typelibs.find { |t| t.name =~ /P2ClientGate / }
  error "No registered STA P2ClientGate, please register P2ClientGate.dll" unless p2lib
  super p2lib.name
end

Class Method Details

.defaultObject

Returns default lib if not explicitely instantiated



9
10
11
# File 'lib/p2ruby/library.rb', line 9

def self.default
  @library ||= new
end

Instance Method Details

#find(name) ⇒ Object



19
20
21
# File 'lib/p2ruby/library.rb', line 19

def find name
  self.ole_types.map(&:progid).compact.find { |progid| progid[name] }
end