How to retrieve value from multidimensional array in Ruby? -


what's simplest way retrieve english array providing en?

languages = [   ['english', 'en'],   ['deutsch', 'de'] ] 

array#rassoc fits use case perfectly.

languages = [   ['english', 'en'],   ['deutsch', 'de'] ] languages.rassoc("en")[0] => "english" 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -