Thanks evelyn for the announce. I will use it for the blog :)
> On 8 Feb 2021, at 09:40, Evelyn Cusi Lopez <cusi.eve...@gmail.com> wrote: > > 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. -------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr / http://www.pharo.org 03 59 35 87 52 Assistant: Aurore Dalle FAX 03 59 57 78 50 TEL 03 59 35 86 16 S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France