Aligning Case with When and Else
Hi,
I'd like to set up RubyMine to line up my case statements as follows by default, but I don't know how.
# Determine US generation name based on birth year
# Case expression tests ranges with ===
generation = case birthyear
when 1946..1963: "Baby Boomer"
when 1964..1976: "Generation X"
when 1978..2000: "Generation Y"
else nil
end
Thank you. :)
请先登录再写评论。
Go to File|Settings|Code Style|Ruby, select "Other" tab and uncheck "indent when case".
Hope this helps, Oleg.
Sory for bumping old subject. But I have a question: why this option checked by default?
In https://github.com/bbatsov/ruby-style-guide
And https://github.com/styleguide/ruby says the same.
Is ruby mine not folloy style-guide or this guides not authoritative?
I think the only reason is that the default setting for this option was selected before the guide.
And after that nobody actually care to report this problem to us :( All-in-all it is just one time change if you want to follow the guide ;)
I'd suggest you to file a ticket about this in our tracker (http://youtrack.jetbrains.com/issues/RUBY) and we will change the setting.
Oleg.