X Tutup
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
An implementation of a dynamic varaible based on notifications.

Dialects that do not support dynamic variables or thread/process local variables can create an empty subclass of this class called GRDynamicVariable.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defaults
defaultValue
^ nil
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
evaluating
use: anObject during: aBlock
"Set the dynamic value of the receiver to anObject during the evaluation of aBlock."

^ aBlock on: self do: [ :notification | notification resume: anObject ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
evaluating
value
"Answer the dynamic value of the receiver."

^ self signal
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defaults
defaultAction
^ self class defaultValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"instance" : {
"defaultAction" : "pmm 9/5/2017 14:30"
},
"class" : {
"value" : "pmm 9/5/2017 14:31",
"defaultValue" : "pmm 9/5/2017 14:31",
"use:during:" : "pmm 9/5/2017 14:32"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "pmm 9/5/2017 14:34",
"super" : "GRNotification",
"category" : "Grease-Core-Utilities",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRNotificationBasedDynamicVariable",
"type" : "normal"
}
4 changes: 2 additions & 2 deletions repository/Grease-Core.package/monticello.meta/version

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests
testAnswer
self assert: (GRNotificationBasedDynamicVariable use: 'value' during: [ true ])
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tests
testWithNestedValue
GRNotificationBasedDynamicVariable
use: 'outer'
during: [
GRNotificationBasedDynamicVariable
use: 'inner'
during: [ self assert: GRNotificationBasedDynamicVariable value = 'inner' ].
self assert: GRNotificationBasedDynamicVariable value = 'outer' ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tests
testWithValue
GRNotificationBasedDynamicVariable
use: 'value'
during: [ self assert: GRNotificationBasedDynamicVariable value = 'value' ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tests
testWithoutValue
self assert: GRNotificationBasedDynamicVariable value isNil
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"instance" : {
"testWithValue" : "pmm 9/5/2017 14:39",
"testWithoutValue" : "pmm 9/5/2017 14:39",
"testWithNestedValue" : "pmm 9/5/2017 14:38",
"testAnswer" : "pmm 9/5/2017 14:37"
},
"class" : { }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"commentStamp" : "",
"super" : "TestCase",
"category" : "Grease-Tests-Core",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [ ],
"name" : "GRNotificationBasedDynamicVariableTest",
"type" : "normal"
}

Large diffs are not rendered by default.

X Tutup