Skip to content

Instantly share code, notes, and snippets.

@kirel
Created August 7, 2008 12:18
Show Gist options
  • Save kirel/4390 to your computer and use it in GitHub Desktop.
Save kirel/4390 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby1.9
def Hash.smash(keys, values)
h = {}
keyiterator,valueiterator = keys.each, values.each
loop { h[keyiterator.next] = valueiterator.next }
h
end
Hash.smash [1,2,3,4], [5,6,7,8] # => { 1=>5, 2=>6, 3=>7, 4=>8 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment