Skip to content

Instantly share code, notes, and snippets.

@mvrilo
Created September 18, 2012 04:18
Show Gist options
  • Save mvrilo/3741241 to your computer and use it in GitHub Desktop.
Save mvrilo/3741241 to your computer and use it in GitHub Desktop.
# separating emails by the host
hash = {}
%w{ [email protected] [email protected] }.each do |mail|
id, host = mail.split("@")
hash[host] ||= []
hash[host] << id
end
# >> hash
# => {"gmail.com"=>["mvrilo", "mvrilo+test"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment