I recently upgraded to Ruby 2.1.3 and to my surprise I started getting some syntax errors. The smallest instance of the problem can be seen here:
{blah: if true then :bleh end}
which in Ruby 2.1.2 produces:
=> {:blah=>:bleh}
while in 2.1.3 produces:
SyntaxError: (irb):1: syntax error, unexpected modifier_if
{blah: if true then :bleh end}
^
A more realistic example would be:
{blah: bleh
blih: if false
blah
elsif true
bloh
else
bluh
end}
(yes, it's not very common to write code like that, I know, but I got used to that in Haskell and I think it makes for very concise and readable code).
Did Ruby 2.1.3 break backward compatibility here? If so, this should be a bug according to the rules of semantic versioning, right?
Or was unknowingly I abusing a bug of the parser that got patched?
Is there some (other) way of writing if-conditions as expressions?