Module: COM
- Defined in:
- lib/com.rb,
lib/com/version.rb
Overview
COM is an object-oriented wrapper around WIN32OLE. COM makes it easy to add behavior to WIN32OLE objects, making them easier to work with from Ruby.
Defined Under Namespace
Modules: HResultError, PatternError, StandardError Classes: Error, Events, Instantiable, MethodInvocationError, Object, Wrapper
Constant Summary collapse
- COMCodePageToIconvCharset =
{ WIN32OLE::CP_UTF8 => 'UTF-8' }.freeze
- Version =
'0.4.0'
Class Method Summary collapse
-
.charset ⇒ String
Gets the iconv character set equivalent of the current COM code page.
-
.connect(id) ⇒ COM::MethodMissing
Connects to a running COM object.
-
.new(id, host = nil) ⇒ COM::MethodMissing
Creates a new COM object.
Class Method Details
.charset ⇒ String
Gets the iconv character set equivalent of the current COM code page.
15 16 17 18 19 |
# File 'lib/com.rb', line 15 def charset COMCodePageToIconvCharset[WIN32OLE.codepage] or raise 'no iconv charset associated with current COM codepage: %s' % WIN32OLE.codepage end |
.connect(id) ⇒ COM::MethodMissing
Connects to a running COM object.
This method shouldn’t be used directly, but rather is used by COM::Object.
31 32 33 34 35 |
# File 'lib/com.rb', line 31 def connect(id) Wrapper.new(WIN32OLE.connect(id)) rescue WIN32OLERuntimeError => e raise Error.from(e) end |
.new(id, host = nil) ⇒ COM::MethodMissing
Creates a new COM object.
This method shouldn’t be used directly, but rather is used by COM::Object.
47 48 49 50 51 |
# File 'lib/com.rb', line 47 def new(id, host = nil) Wrapper.new(WIN32OLE.new(id, host)) rescue WIN32OLERuntimeError => e raise Error.from(e) end |