Created
April 28, 2012 05:15
-
-
Save zolrath/2516236 to your computer and use it in GitHub Desktop.
More Idiomatic Code Example
This file contains 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
# Current Example: | |
(1..albums.length).each do |i| | |
eb.send(pa, { | |
'action' => 'save', | |
'collection' => 'albums', | |
'document' => albums[i - 1] | |
}) | |
end | |
# More Idiomatic Ruby: | |
albums.each do |album| | |
eb.send(pa, { | |
'action' => 'save', | |
'collection' => 'albums', | |
'document' => album | |
}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment