AndrewRadev/splitjoin.vim — pull request #23 by LFDM (2014-02-01 22:38:57+00:00)
Title: Ruby: Ternary and case support

Closes #22

- Adds splitjoin functions to handle Ruby's ternary operator
An argument can be made to use the other tense one-line statement for Ruby's `if-else` construct, but that looks more awkward to me than the good old ternary operator (`if condition then x else y end` - having an `end` lingering around on the line makes this look pretty weird imo)
It also handles variable assignments, adding parentheses to the ternary itself, as in: `x = (condition ? true : false)`. Specs are included.

- Adds splitjoin function to hande Ruby's case switches
There are two triggers: You can invoke splitjoin on single `when` lines, or invoke on the `case` line itself, which calls the `when` functions on all included `when-then` statements, including the `else` case. Confer to the spec file to see what it exactly does (and what it doesn't!)
You will notice that one spec example is commented out: For tense `case` switches that only include `when-then` one-liners, the alignment tools are invoked. This is at the moment however impossible to test. It probably makes no sense to add an alignment tool to the spec dependencies, and I don't think that this experimental spec platform can handle stubbing of the `Tabular` or `Align` plugin. I left the spec in for referencing purposes. Your decision how you want to handle this of course!

If you want I can add more descriptive comments to the code - I haven't done yet because the rest of the code is also not drowned in comments. Code is also relatively simple to follow, but as I said, would be no problem to add more!

Thx for splitjoin (and switch, while we're at it :+1:)!