I have an array like this:
myarray = ['value1','value2','value3']
And I’m looking for a one element array like this:
mynewarray = ['value1|value2|value3']
I know how to do that using each and concatening in a string, but I’m wondering if there is a oneliner and beautiful Ruby way of doing so…
You can use the Array#join method.
Array#join doc:
Returns a string created by converting each element of the array to
a string, separated by sep.