Last active
August 29, 2015 14:18
-
-
Save samuraijane/6ab26d6fee32f9c2460e to your computer and use it in GitHub Desktop.
You can write using a block or write the code on one line when nesting maps. This code shows you how to do both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Code with block | |
$myvariable= imgarray.map do |layouts| | |
layouts[ 'layouts' ].map do |layout_name| | |
layout_name['layout_name'] | |
end | |
end | |
#Code on one line | |
$myvariable= (imgarray.map{ |layouts| (layouts[ 'layouts' ]).map{ |layout_name| (layout_name[ 'layout_name' ]) }} ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment