Module: WineOLE
- Defined in:
- lib/wineole.rb,
lib/wineole/proxy.rb,
lib/wineole/client.rb,
lib/wineole/errors.rb
Defined Under Namespace
Classes: Client, Error, NotSerializableError, ProtocolError, Proxy, RemoteError, StaleReferenceError
Class Method Summary collapse
-
.close ⇒ Object
Closes the implicit default client, if one exists, and clears it so the next .create/.connect lazily opens a fresh one.
- .connect(class_name) ⇒ Object
- .connect_or_create(class_name) ⇒ Object
- .create(class_name) ⇒ Object
-
.open ⇒ Object
Opens a client the same way Client.open does, and also makes it the module's implicit default -- a subsequent WineOLE.create/.connect call uses this client rather than lazily creating a separate zero-config one.
Class Method Details
.close ⇒ Object
Closes the implicit default client, if one exists, and clears it so the next .create/.connect lazily opens a fresh one. Mainly for test hygiene (clearing state between test cases); also usable to release the implicit default early in a long-running process.
51 52 53 54 55 56 |
# File 'lib/wineole.rb', line 51 def self.close @mutex.synchronize do @default_client&.close @default_client = nil end end |
.connect(class_name) ⇒ Object
39 40 41 |
# File 'lib/wineole.rb', line 39 def self.connect(class_name) default_client.connect(class_name) end |
.connect_or_create(class_name) ⇒ Object
43 44 45 |
# File 'lib/wineole.rb', line 43 def self.connect_or_create(class_name) default_client.connect_or_create(class_name) end |
.create(class_name) ⇒ Object
35 36 37 |
# File 'lib/wineole.rb', line 35 def self.create(class_name) default_client.create(class_name) end |
.open ⇒ Object
Opens a client the same way Client.open does, and also makes it the module's implicit default -- a subsequent WineOLE.create/.connect call uses this client rather than lazily creating a separate zero-config one. Calling .open again replaces the implicit default without closing whatever it previously pointed to -- the caller owns the returned client and is responsible for closing it if not relying on the implicit default's eventual GC-finalizer cleanup.
16 17 18 19 20 |
# File 'lib/wineole.rb', line 16 def self.open(...) client = Client.open(...) @mutex.synchronize { @default_client = client } client end |