Reading Refactoring: Ruby Edition I came across an example of assigning a variable via a case statement. For example:
Using the return values from the case statement directly for the assignment is much cleaner than the way I used to do it:
I'm learning that most case statements are prime candidates for refactoring. The direct assignment is a nice way to use them until that happens.