SnapShotImage.st
changeset 1560 453fa7d78437
parent 1483 f27b959005c9
child 1584 51c53d6656f4
--- a/SnapShotImage.st	Thu Mar 28 13:58:16 2002 +0100
+++ b/SnapShotImage.st	Mon Apr 08 11:49:38 2002 +0200
@@ -134,6 +134,27 @@
     ^ globals at:aKey ifAbsent:exceptionValue
 !
 
+classNamed:aString
+    "return the class with name aString, or nil if absent.
+     To get to the metaClass, append ' class' to the string."
+
+    |cls sym meta|
+
+    "be careful, to not invent new symbols ..."
+    sym := aString asSymbol.
+    cls := self at:sym ifAbsent:[].
+    cls isBehavior ifTrue:[^ cls].
+
+    (aString endsWith:' class') ifTrue:[
+
+        meta := self classNamed:(aString copyWithoutLast:6).
+        meta notNil ifTrue:[
+            ^ meta class
+        ].
+    ].
+    ^ nil
+!
+
 keysAndValuesDo:aTwoArgBlock
     globals isNil ifTrue:[
         self fetchGlobals