The only thing I really don't like here is non indenting when inside case. I know that technically it's not a block, but in practice I find it much less readable
Everyone agrees with you on readabilty. I think that's why they had to add this bit about this (A bit of History) section...
"This is the style established in both "The Ruby Programming Language" and "Programming Ruby". Historically it is derived from the fact that case and switch statements are not blocks, hence should not be indented, and the when and else keywords are labels (compiled in the C language, they are literally labels for JMP calls)."
No, everyone does most assuredly not agree on readability when it comes to case statements. Flat case reads better, and indenting it would be like indenting "elsif" and "else" in an else statement.
yeah, even more, taking the example from the style guide, if lines are short enough, I love doing:
case
when song.name == 'Misty' ; puts 'Not again!'
when song.duration > 120 ; puts 'Too long!'
when Time.now.hour > 21 ; puts "It's too late"
else
song.play
end
even more, for simple if/elses, many times I do:
if member.coding_style.vertical_align?
then friends << member
else member.show_example(code)
end
"This is the style established in both "The Ruby Programming Language" and "Programming Ruby". Historically it is derived from the fact that case and switch statements are not blocks, hence should not be indented, and the when and else keywords are labels (compiled in the C language, they are literally labels for JMP calls)."