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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Edgar J. De Cleene
[Q] How you know author of methods in some Class ? 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