[Pharo-users] RB - New introduced refactorings
Hello all, These weeks I added new refactorings, following I will give some examples of them. *1. Create accessors with lazy initialization* This refactoring create accessors for variables with lazy initialization, for example: - we have a class Object subclass: #SomeClass instanceVariableNames: 'stringVar' classVariableNames: '' package: 'Example' - we can create accessors with lazy initialization executing this script: (RBCreateAccessorsWithLazyInitializationForVariableRefactoring variable: #stringVar class: SomeClass classVariable: false defaultValue: '''example''') execute the result of this refactoring is: SomeClass >> stringVar ^ stringVar ifNil: [ stringVar := '' ] SomeClass >> stringVar: anObject stringVar := anObject *2. Extract setUp refactoring* (is the first version by the moment, it need to be improved) This refactoring create a setUp method from a code fragment. You can select an interval of some code in a test method and call this refactoring to create a setUp method implementing that code and replace the code by nothing. The selected class need to be a subclass of TestCase. For example: - given a class TestCase subclass: #SomeTest instanceVariableNames: '' classVariableNames: '' package: 'Example' SomeTest >>testFoo self x. self assert: true SomeTest >> self x self doSomething - To extract setUp method you can execute this script: (RBExtractSetUpMethodRefactoring extract: (10 to: 16) from: #testFoo in: SomeTest) execute the result of this refactoring is: SomeTest >> setUp super setUp. self x. SomeTest >> testFoo self assert: true *3. Move method to class side refactoring* (This refactoring is still awaiting review) This refactoring move a method to class side. For example: - given a method ClassX >> annotatedBlockMarkup ^ '@@' - we can execute the refactoring with this script: (RBMoveMethodToClassSideRefactoring method: (ClassX >> #annotatedBlockMarkup) class: ClassX) execute. the result of this refactoring is: ClassX >> annotatedBlockMarkup ^ self class annotatedBlockMarkup ClassX class >> annotatedBlockMarkup ^ '@@' Any suggestions or comment of these refactorings are welcome. I hope these new refactorings are useful to you . Regards, Evelyn C.
[Pharo-users] Re: pharo 8 - method versions - how to see author/timestamp?
Esteban, Is there a hack I can do to put the timestamp in the VersionBrowser? Thanks Davide Esteban Lorenzano wrote > versions are going to stay there, we never even thought on removing that > ;) > they will come from Epicea instead the changes file (because yes, we want > to remove the changes file... but this one is a hard one ;) ). > and yes, they will have a timestamp (which is what the in-image versions > is lacking now). > > Esteban > On Feb 5 2021, at 4:47 pm, Noury Bouraqadi < > bouraqadi@ > > wrote: >> So, will this remain in the image, and the timestamp will be eventually >> fixed? >> >> Thanks -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html