Skip to content

Instantly share code, notes, and snippets.

@danielevans
Created February 5, 2014 22:53
Show Gist options
  • Save danielevans/8835027 to your computer and use it in GitHub Desktop.
Save danielevans/8835027 to your computer and use it in GitHub Desktop.
module_function
def MultiHash h
h.keys.each do |key|
if key.is_a? Array
key.each do |new_key|
h[new_key] = h[key]
end
h.delete key
end
end
h
end
MultiHash(%w(a b c) => :d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment