I have an array in Ruby, like ["dog", "cat", bat"]. How can I join them into a single string with words separated by spaces, like "dog cat bat"? I know it’s easy to iterate over the elements and join them one-by-one, but is there a one-line way?
I have an array in Ruby, like [dog, cat, bat] . How can I
Share
1 Answer