forked from ObjectProfile/PythonBridge
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPBRegistryFinalizer.class.st
More file actions
56 lines (48 loc) · 1.23 KB
/
PBRegistryFinalizer.class.st
File metadata and controls
56 lines (48 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Class {
#name : #PBRegistryFinalizer,
#superclass : #PBAbstractFinalizer,
#instVars : [
'pythonVariable',
'executionHandler'
],
#category : #'PythonBridge-Execution'
}
{ #category : #accessing }
PBRegistryFinalizer class >> pythonVariable: aPythonVariable executionHandler: executionHandler [
^ self new
pythonVariable: aPythonVariable;
executionHandler: executionHandler
yourself
]
{ #category : #accessing }
PBRegistryFinalizer >> executionHandler [
^ executionHandler
]
{ #category : #accessing }
PBRegistryFinalizer >> executionHandler: anObject [
executionHandler := anObject
]
{ #category : #finalization }
PBRegistryFinalizer >> finalize [
| cf |
executionHandler isRunning ifFalse: [ ^ self ].
cf := executionHandler newCommandFactory.
cf << (self removeId: pythonVariable name).
cf send.
]
{ #category : #accessing }
PBRegistryFinalizer >> pythonVariable [
^ pythonVariable
]
{ #category : #accessing }
PBRegistryFinalizer >> pythonVariable: anObject [
pythonVariable := anObject
]
{ #category : #asserting }
PBRegistryFinalizer >> registryExpression [
^ #registry callWith: #()
]
{ #category : #asserting }
PBRegistryFinalizer >> removeId: anId [
^ self registryExpression => #clean callWith: (Array with: anId)
]