RBAddClassRefactoring ensuring existence

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

RBAddClassRefactoring ensuring existence

Peter Uhnak
Hi,

is it possible to "ensure" that class exists with RBAddClassRefactoring?

Right now RBAddClassRefactoring will throw up if the class already exists.

I would like it to create the class if it doesn't exist and just do nothing if it already exists.

Is it possible? (if not I will just work around it on my side).

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: RBAddClassRefactoring ensuring existence

Nicolai Hess-3-2


2016-04-16 20:59 GMT+02:00 Peter Uhnák <[hidden email]>:
Hi,

is it possible to "ensure" that class exists with RBAddClassRefactoring?

Right now RBAddClassRefactoring will throw up if the class already exists.

I would like it to create the class if it doesn't exist and just do nothing if it already exists.

Is it possible? (if not I will just work around it on my side).

Thanks,
Peter


The ugly way:

[ refactoring execute ] on: RBRefactoringError do:[:ex | ex resume].

Reply | Threaded
Open this post in threaded view
|

Re: RBAddClassRefactoring ensuring existence

Peter Uhnak
The ugly way:

[ refactoring execute ] on: RBRefactoringError do:[:ex | ex resume].

I thought about this, but there are many things that could go wrong (there are about ten preconditions), and I am certainly not interested in breaking my system by accident.

However after fighting a lot with refactorings I found that I would need this behavior for many other things… ensuring that attribute exists, that method is the same... etc.
And since there is no such support in refactorings it's kind of pointless for me to use as I will need to always work around it... or maybe I could make some sort of "Ensuring" framework on top...

Peter