Skip to content

Instantly share code, notes, and snippets.

@msuarz
Last active December 25, 2015 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msuarz/7042037 to your computer and use it in GitHub Desktop.
Save msuarz/7042037 to your computer and use it in GitHub Desktop.
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
Copy link

Ruby is nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment