Is there a more elegant way of doing this logic in ruby
a = nil #=> obviously 'a' can have value but I am just setting it nil to make the eg more clear
b = a
unless b
b = "value"
end
so that we have the value of b set in the end. We could have another variation of the above code like so
a = nil
b = a
b ||= "value"
and I can also use ternary statement to write the above code like
b = a ? a : "value"
but if you replace variable a and "value" with a long line of code then this ternary statement will start looking ugly too.
Can the above logic be made more elegant / expressive somehow or are we limited to just the above solutions?