6

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.

2 Answers 2

23

Array#flatten

[["http://instagr.am/r/123"],["http://instagr.am/r/456"]....].flatten
Sign up to request clarification or add additional context in comments.

Comments

2
array.map(&:first)

...............

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.