It is like 'Extract method' but instead of extracting the selected code to
the same class it extracts it to another class - the class of a variable of
the method - and the original method calls the new method on that variable,
not on self. The idea is that if, as a system develops, you find you have
myFunction tasks do:
[:each | (myFunction shouldHandle: each)
ifTrue: [myFunction handle: each]].
it can be extracted to
self tasks do:
[:each | self shouldHandle: each)
ifTrue: [self handle: each]].
On invoking it, you get a dialog asking which variable is the target. On
selecting one, you will be asked to choose a suitable class from a list
which the refactoring guesses represent possible classes for instances held
in that variable. You can add your own class to the list. The rewriting
replaces direct references to the instVar or parameter chosen with 'self' .
It will also replace references to self in the original with some accessor
for which the user is prompted if required, etc.