Skip to content

Instantly share code, notes, and snippets.

@zolrath
Created April 28, 2012 05:15
Show Gist options
  • Save zolrath/2516236 to your computer and use it in GitHub Desktop.
Save zolrath/2516236 to your computer and use it in GitHub Desktop.
More Idiomatic Code Example
# 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