Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting an Array of Arrays into an Array of Strings

I currently have an array of arrays. There are 10 single-item arrays in my overall array

[["http://instagr.am/r/123"],["http://instagr.am/r/456"]....]

My goal is to clean this up so that it is an array of strings.

Ex:

[http://instagr.am/r/123, http://instagr.am/r/456, ... ]

I have been racking Google trying to find a solution for this but I seem to be unable to find one and I was hoping that you kind folks could help out an emerging Rubyist.

like image 599
Zack Shapiro Avatar asked Jan 28 '12 22:01

Zack Shapiro


1 Answers

Array#flatten

[["http://instagr.am/r/123"],["http://instagr.am/r/456"]....].flatten
like image 60
three Avatar answered Oct 27 '22 19:10

three