NameSpace.st
changeset 10587 d0e5f934141a
parent 10372 44ba935b47ba
child 11999 5c5947a4b464
child 17711 39faaaf888b4
--- a/NameSpace.st	Thu May 31 18:00:24 2007 +0200
+++ b/NameSpace.st	Thu May 31 18:28:08 2007 +0200
@@ -321,6 +321,19 @@
     "Modified: 8.11.1996 / 21:40:01 / cg"
 !
 
+at:aKey ifPresent:aBlock
+    "try to retrieve the value stored at aKey.
+     If there is nothing stored under this key, do nothing.
+     Otherwise, evaluate aBlock, passing the retrieved value as argument."
+
+    (self includesKey:aKey) ifTrue:[
+        ^ aBlock value:(self at:aKey)
+    ].
+    ^ nil
+
+    "Modified: / 31-05-2007 / 17:50:46 / cg"
+!
+
 at:classNameSymbol put:aClass
     "add a class to the namespace defined by the receiver"
 
@@ -591,5 +604,5 @@
 !NameSpace class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.65 2007-02-05 15:40:19 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/NameSpace.st,v 1.66 2007-05-31 16:28:08 cg Exp $'
 ! !