#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Fri, 18 Nov 2016 18:06:46 +0100
changeset 4161 55ad833b981e
parent 4160 29602d7fb4c9
child 4163 32d1c2c5719b
child 4166 66a7a47f9253
#REFACTORING by cg class: VersionInfo class definition added: #author: #logMessage #logMessage: comment/format in: #binaryRevision: #fileName: #revision: #user: changed:5 methods
VersionInfo.st
--- a/VersionInfo.st	Fri Nov 18 18:06:02 2016 +0100
+++ b/VersionInfo.st	Fri Nov 18 18:06:46 2016 +0100
@@ -14,7 +14,8 @@
 "{ NameSpace: Smalltalk }"
 
 Object subclass:#VersionInfo
-	instanceVariableNames:'revision binaryRevision user timestamp date time fileName state'
+	instanceVariableNames:'moreAttributes logMessage revision binaryRevision user timestamp
+		date time fileName state'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-SourceCodeManagement'
@@ -52,13 +53,12 @@
 
 !VersionInfo methodsFor:'accessing'!
 
-at:aKey
+at:aSymbolKey
     "backward compatible dictionary-like accessing"
 
-    (self respondsTo:aKey) ifTrue:[
-        ^ self perform:aKey
-    ].
-    ^ self errorKeyNotFound:aKey
+    ^ self 
+        at:aSymbolKey 
+        ifAbsent:[ self warn:'VersionInfo: no such property: ',aSymbolKey. nil]
 
     "
      self new at:#binaryRevision
@@ -68,13 +68,16 @@
     "Modified: / 22-10-2008 / 20:23:31 / cg"
 !
 
-at:aKey ifAbsent:replacement
+at:aSymbolKey ifAbsent:replacement
     "backward compatible dictionary-like accessing"
 
-    (self respondsTo:aKey) ifTrue:[
-        ^ (self perform:aKey) ? replacement
+    (self respondsTo:aSymbolKey) ifTrue:[
+        ^ (self perform:aSymbolKey)
     ].
-    ^ replacement
+    moreAttributes notNil ifTrue:[
+        ^ moreAttributes at:aSymbolKey ifAbsent:replacement
+    ].    
+    ^ replacement value
 
     "
      self new at:#binaryRevision
@@ -84,18 +87,25 @@
     "Created: / 22-10-2008 / 20:19:42 / cg"
 !
 
-at:aKey put:value
+at:aSymbolKey put:value
     "backward compatible dictionary-like accessing"
 
-    (self respondsTo:aKey) ifTrue:[
-        self perform:aKey asMutator with:value.
+    |setter|
+
+    setter := aSymbolKey asMutator.
+    (self respondsTo:setter) ifTrue:[
+        self perform:setter with:value.
         ^ value "/ sigh
     ].
-    ^ self errorKeyNotFound:aKey
+    moreAttributes isNil ifTrue:[
+        moreAttributes := IdentityDictionary new.
+    ].
+    moreAttributes at:aSymbolKey put:value.
+    ^ value "/ sigh
 
     "
      self new at:#binaryRevision put:#bar
-     self new at:#foo put:#bar
+     self new at:#foo put:#bar; yourself
     "
 
     "Created: / 22-10-2008 / 20:20:54 / cg"
@@ -107,12 +117,18 @@
     "Created: / 21-12-2011 / 23:09:54 / cg"
 !
 
+author:aString
+    ^ self user:aString
+
+    "Created: / 21-12-2011 / 23:09:54 / cg"
+!
+
 binaryRevision
     ^ binaryRevision
 !
 
-binaryRevision:something
-    binaryRevision := something.
+binaryRevision:aString
+    binaryRevision := aString.
 !
 
 date
@@ -132,16 +148,29 @@
     ^ fileName
 !
 
-fileName:something
-    fileName := something.
+fileName:aString
+    fileName := aString.
 !
 
 keysAndValuesDo:aBlock
     self class instVarNames do:[:nm |
-        aBlock value:(nm asSymbol) value:(self perform:nm asSymbol)
+        nm ~= 'moreAttributes' ifTrue:[   
+            aBlock value:(nm asSymbol) value:(self perform:nm asSymbol)
+        ].
+    ].
+    moreAttributes notNil ifTrue:[
+        moreAttributes keysAndValuesDo:aBlock
     ].
+    
+    "Created: / 22-10-2008 / 20:48:08 / cg"
+!
 
-    "Created: / 22-10-2008 / 20:48:08 / cg"
+logMessage
+    ^ logMessage
+!
+
+logMessage:aString
+    logMessage := aString.
 !
 
 majorVersion
@@ -184,8 +213,8 @@
     ^ revision
 !
 
-revision:something
-    revision := something.
+revision:aString
+    revision := aString.
 !
 
 state
@@ -237,8 +266,8 @@
 !
 
 timezone
-    "raise an error: must be redefined in concrete subclass(es)"
-
+    timestamp notNil ifTrue:[^ timestamp timezone].
+    
     ^ nil "Not known"
 
     "Modified: / 23-11-2011 / 13:54:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -248,8 +277,8 @@
     ^ user
 !
 
-user:something
-    user := something.
+user:aString
+    user := aString.
 ! !
 
 !VersionInfo class methodsFor:'documentation'!