ruby-style-guide
                                
                                 ruby-style-guide copied to clipboard
                                
                                    ruby-style-guide copied to clipboard
                            
                            
                            
                        A clarification regarding the use of when / then
In a case statement with several when clauses, if most of the when clauses are short enough to be written in the when/then form, but one or two are longer and must be written in the form:
when foo
  bar...
should all whens be written in the second form or is it acceptable to have both oneliners and multiliners, like:
case x
when a then b
when c
  # do something
else
  # do something else
end
?
I personally never mix one-liners and multi-liners. I feel that the visual consistency is important.
I usually mix them, but I'm curious about other opinions.
Interesting question! I'm not sure what I actually do in practice, but I think I usually don't mix them. :-) We should probably add some rule on the subject.
😄 5 years later, I can say - I don't mix them :)