Skip to content

Instantly share code, notes, and snippets.

@msuarz msuarz/zip.rb

Last active Dec 25, 2015
Embed
What would you like to do?
zip it baby
#ugly
(0..servers.count - 1).each { |i| servers[i][:ip] = ips[i] }
#pretty
servers.each_with_index { |server, i| server[:ip] = ips[i] }
#beautiful
servers.zip(ips) { |server, ip| server[:ip] = ip }
@darrencauthon

This comment has been minimized.

Copy link

darrencauthon commented Oct 18, 2013

Ruby is nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.