Reputation: 185
I have an array like so: ["data","data2"]
What would be the most Ruby-like way to convert this into a string with brackets included: "['data','data2']"
Thanks
Upvotes: 2
Views: 3262
Reputation: 45057
I can't say how "ruby-ish" this is, but it's what I would typically do:
puts "['" + array_of_strings.join("','") + "']"
Upvotes: 5