X Tutup
Skip to content

Commit 80123e7

Browse files
committed
Add GRNotificationBasedDynamicVariable
1 parent c9e1ca6 commit 80123e7

File tree

16 files changed

+83
-3
lines changed

16 files changed

+83
-3
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
An implementation of a dynamic varaible based on notifications.
2+
3+
Dialects that do not support dynamic variables or thread/process local variables can create an empty subclass of this class called GRDynamicVariable.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
defaults
2+
defaultValue
3+
^ nil
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
evaluating
2+
use: anObject during: aBlock
3+
"Set the dynamic value of the receiver to anObject during the evaluation of aBlock."
4+
5+
^ aBlock on: self do: [ :notification | notification resume: anObject ]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
evaluating
2+
value
3+
"Answer the dynamic value of the receiver."
4+
5+
^ self signal
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
defaults
2+
defaultAction
3+
^ self class defaultValue
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"instance" : {
3+
"defaultAction" : "pmm 9/5/2017 14:30"
4+
},
5+
"class" : {
6+
"value" : "pmm 9/5/2017 14:31",
7+
"defaultValue" : "pmm 9/5/2017 14:31",
8+
"use:during:" : "pmm 9/5/2017 14:32"
9+
}
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"commentStamp" : "pmm 9/5/2017 14:34",
3+
"super" : "GRNotification",
4+
"category" : "Grease-Core-Utilities",
5+
"classinstvars" : [ ],
6+
"pools" : [ ],
7+
"classvars" : [ ],
8+
"instvars" : [ ],
9+
"name" : "GRNotificationBasedDynamicVariable",
10+
"type" : "normal"
11+
}

repository/Grease-Core.package/monticello.meta/version

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

repository/Grease-Tests-Core.package/GRNotificationBasedDynamicVariableTest.class/README.md

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tests
2+
testAnswer
3+
self assert: (GRNotificationBasedDynamicVariable use: 'value' during: [ true ])

0 commit comments

Comments
 (0)
X Tutup