[squeak-dev] Fwd: refactoring

Helmut Rohregger helmut.rohregger at gmail.com
Wed Apr 23 19:01:58 UTC 2014


That helped! Thank you Eliot!

Thats the code I wrote, which moved all methods from one class into
another...

moveFrom: srcClass to: destClass
   | categories |
   categories := (srcClass organization) categories.
   1 to: categories size do: [ :index |
      destClass copyCategory: (categories at: index) from: srcClass.
      srcClass removeCategory: (categories at: index).	
   ].


- Helmut

Am 23.04.2014 18:37, schrieb Eliot Miranda:
> 
> 
> 
> On Wed, Apr 23, 2014 at 12:50 AM, Helmut Rohregger
> <helmut.rohregger at gmail.com <mailto:helmut.rohregger at gmail.com>> wrote:
> 
>     Thanks.
> 
>     The methods now have been moved to the method dictionary of the
>     specified class, but don't show up in the method browser. How do I clone
>     the categories?
> 
> 
> hmmm, that'll teach me to write code off the top of my head.  Instead use 
>  
> class selectors do: [:s| class class copy: s from: class. class
> removeSelector: s]
> 
> See also copyAll:from: in ClassDescription
> 
> 
>     - Helmut
> 
>     Am 23.04.2014 08:22, schrieb Eliot Miranda:
>     > class selectors do: [:s| class class recompile: s from: class.
>     class removeSelector: s]
>     >
>     > Eliot (phone)
>     >
>     > On Apr 22, 2014, at 11:18 PM, Helmut Rohregger
>     <helmut.rohregger at gmail.com <mailto:helmut.rohregger at gmail.com>> wrote:
>     >
>     >> Hi,
>     >>
>     >> because I didn't get response to my question in the beginners list, I
>     >> post it here.
>     >>
>     >> Is there an easy way to change instance methods to class methods?
>     >> I know it is possible to drag and drop single methods. But I am
>     looking
>     >> for the possibility to move 100+ methods at once.
>     >>
>     >> - Helmut
>     >>
>     >
> 
> 
> 
> 
> 
> -- 
> best,
> Eliot
> 
> 
> 



More information about the Squeak-dev mailing list