Skip to content

Instantly share code, notes, and snippets.

@dfenjves
Created February 11, 2014 21:19
Show Gist options
  • Save dfenjves/8944418 to your computer and use it in GitHub Desktop.
Save dfenjves/8944418 to your computer and use it in GitHub Desktop.
email parser
# Build a class EmailParser that accepts a string of unformatted
# emails. The parse method on the class should separate them into
# unique email addresses. The delimiters to support are commas (',')
class EmailParser
def initialize(emails)
@emails = emails
end
def parse
@emails.split(/\s|, /).uniq.collect {|email| email.strip}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment