Assign to conditional

Assume the following code:

if c
a=x
else
b=x
end

The intend of this would be much clearer expressed, if we could use
something like

This is syntactically incorrect!

(c ? a : b) = x

because it would make clear, that this code snippet would transfer the
value of x, and the condition decides where the value would go to. This
doesn’t work in Ruby, because the result of a conditional operator is
not something we can assign to. This is a purely syntactic restriction:
If a and b are objects where a method “assign” is defined, we can of
course write

(c ? a : b).assign(x)

Now my question:

Is there any way Ruby to write my if-else-end block in a clearer way, or
is this already the best we can do?

What’s wrong with:

c ? a = x : b = x

?

The same as with the original code. That it is in one line, doesn’t
change the issue.

It’s a question of how we communicate the intent of our goal to the
reader. For example,

z = c ? a : b

communicates immediately, that z is assigned a value, and WHICH value is
being assigned, depends on c. Therefore I consider it more clearly than

if c
z = a
else
z = b
end

The “clearliness” doesn’t come from the fact that the first version is
shorter (less to type), but because the reader immediately sees in the
first case, that this piece of code changes z, while in the second case,
he has to examine two lines and deduct that in both cases, the same
variable will be changed. While this is easy here (having one-letter
variable names), we can imagine well that z could be a much longer name
(or expression), where we have to look more carefully, whether both
targets of the assignment are the same.

Similarily,

if c
bee.bop.boo=foo.bar.baz{n]
else
xyz=foo.bar.baz[n]
end

is not that much readable, considering a hypothetical construct

(c ? bee.bop.boo : xyz) = foo.bar.baz{n]

Actually, I would even consider introducing a temporary variable to make
it more readable in this case:

t=foo.bar.baz{n]
if c
bee.bop.boo=t
else
xyz=t
end

The reason, why I posted this, was not to make a suggestion for a change
to the Ruby language (this would probably the wrong forum), but because
from my experience, Ruby is designed to make everything easy and simple,
and I thought that, maybe, there IS a concise way to express such a
conditional in Ruby, and I just don’t know it. Well, maybe there really
is none…