Removing conditionals from code is one of the little games I sometimes play while coding. Here, I’ve extracted the logic of the conditional into another class. The resulting class is _much more_ code than the original. So why do that?
Well, I say you get a few benefits:
* The logic is now far easier to test. It’s a standalone object now rather than a Rails functional test.
* The flow of what’s being done and tested is more decomposed and easier to follow.
* Most importantly, the code explains itself. No need for comments (which will undoubtedly go out of sync over time) here!
While I delight in deleting code and writing as little as possible, refactoring this to _more_ code seems the right way. What say you?