Skip to content

Instantly share code, notes, and snippets.

@maccman
Created January 2, 2012 16:56
Show Gist options
  • Save maccman/1551364 to your computer and use it in GitHub Desktop.
Save maccman/1551364 to your computer and use it in GitHub Desktop.
module Extractor extend self
def extract_email(str)
email = Mail::Address.new(str)
email.domain && email.address
end
def parse(str)
str.split(",").map do |seg|
extract_email(seg)
end.compact
end
end
@darkside
Copy link

darkside commented Jan 2, 2012

I've been doing it on the next line, but it's kinda the same idea, right?

@maccman
Copy link
Author

maccman commented Jan 2, 2012

Yes, just seems that much more elegant :)

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