[squeak-dev] [Q] How you know author of methods in some Class ?

Edgar J. De Cleene edgardec2001 at yahoo.com.ar
Fri Feb 19 11:18:14 UTC 2010


Folks:

I using some like:

Utilities methodsWithInitials: 'edc' inClass: Object

And  for it 

CompiledMethod author
author
    self timeStamp isEmpty
        ifTrue: [^ 'unknown']
        ifFalse: [^ self timeStamp substrings first]

My old implementation is

Utilities class methodsWithInitials:inClass:
methodsWithInitials: targetInitials inClass: aClass
    "Based on a do-it contributed to the Squeak mailing list by Göran
    Hultgen: Browse methods whose initials (in the time-stamp, as logged to
    disk) match the given initials.
    Print out the complete time-stamp table to the Transcript.
    Answer a list of (initials -> count) associations.
    
    CAUTION: It may take several minutes for this to complete."
    "Time millisecondsToRun: [Utilities methodsWithInitials: 'bf']"
    | methodList methodListClass |
    methodList := aClass methodDict
                select: [:cm | cm author = targetInitials].
    methodListClass := aClass class methodDict
                select: [:cm | cm author = targetInitials].
    ^ methodList , methodListClass


Pros, Cons, better ways?
Like to go Trunk if possible...

Edgar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100219/80cbe0c3/attachment.htm


More information about the Squeak-dev mailing list