Given an Array A of n subArrays Sn, how can I select the Array of Sn[i] members in Ruby?
For instance, given an Array of languages as the following:
languages = [ ['Italiano', 'it'], ["English", 'en'], ["Française", 'fr' ] ]
How can I obtain the Array…
locales_in_languages = ['it', 'en', 'fr' ]
…which contains all the language[1] objects?
Is there an easy and ‘rubysh’ way to achieve this?
You can do it with Array#transpose method: