Class: WIN32OLE
- Inherits:
-
Object
- Object
- WIN32OLE
- Defined in:
- lib/ass_launcher/enterprise/ole/win32ole.rb
Overview
Monkey patch for WIN32OLE class
-
Define dummy class for Linux. Fail
NotImplementedErrorin constructor. -
Patch for have chanse to close connection with 1C infobase in class IBConnector. For this reason overload method WIN32OLE#method_missing and hold Ole object refs retuned from ole method into #__objects__ array. IBConnector when close connection call #_<em>ass_ole_free</em>_ and try to ole_free for all in #__objects__ array.
Class Method Summary collapse
-
.__ass_ole_free__(obj) ⇒ Object
private
Try call ole_free for ole object.
Instance Method Summary collapse
-
#__ass_ole_free__ ⇒ Object
private
Call ole_free for all created chiled Ole objects then free self.
-
#__objects__ ⇒ Array
private
Hold created Ole objects.
-
#__real_obj__ ⇒ Object, self
Return Ruby object wrapped in to WIN32OLE.
-
#__ruby__? ⇒ Boolean
True if real object is Ruby object.
-
#initialize(*_) ⇒ WIN32OLE
constructor
A new instance of WIN32OLE.
-
#method_missing(*args) ⇒ Object
For tests.
Constructor Details
#initialize(*_) ⇒ WIN32OLE
Returns a new instance of WIN32OLE.
18 19 20 |
# File 'lib/ass_launcher/enterprise/ole/win32ole.rb', line 18 def initialize(*_) fail NotImplementedError, 'WIN32OLE undefined for this machine' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
For tests
23 24 25 |
# File 'lib/ass_launcher/enterprise/ole/win32ole.rb', line 23 def method_missing(*args) args[1] end |
Class Method Details
.__ass_ole_free__(obj) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Try call ole_free for ole object
76 77 78 79 |
# File 'lib/ass_launcher/enterprise/ole/win32ole.rb', line 76 def self.__ass_ole_free__(obj) return if WIN32OLE.ole_reference_count(obj) <= 0 obj.ole_free end |
Instance Method Details
#__ass_ole_free__ ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Call ole_free for all created chiled Ole objects then free self
59 60 61 62 |
# File 'lib/ass_launcher/enterprise/ole/win32ole.rb', line 59 def __ass_ole_free__ @__objects__ = __ass_ole_free_objects__ self.class.__ass_ole_free__(self) end |
#__objects__ ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Hold created Ole objects
35 36 37 |
# File 'lib/ass_launcher/enterprise/ole/win32ole.rb', line 35 def __objects__ @__objects__ ||= [] end |
#__real_obj__ ⇒ Object, self
WIN32OLE avtomaticaly wrapp Ruby objects into WIN32OLE class when they passed as parameter. When passed object retuns on Ruby side he will keep as WIN32OLE
Return Ruby object wrapped in to WIN32OLE. If #__ruby__? is false return self
52 53 54 55 |
# File 'lib/ass_launcher/enterprise/ole/win32ole.rb', line 52 def __real_obj__ return self unless __ruby__? ObjectSpace._id2ref(invoke :object_id) end |
#__ruby__? ⇒ Boolean
WIN32OLE avtomaticaly wrapp Ruby objects into WIN32OLE class when they passed as parameter. When passed object retuns on Ruby side he will keep as WIN32OLE
True if real object is Ruby object
44 45 46 |
# File 'lib/ass_launcher/enterprise/ole/win32ole.rb', line 44 def __ruby__? ole_respond_to? :object_id end |