diff --git a/lib/email_parser.rb b/lib/email_parser.rb index 4e0f7a62..f3f7df36 100644 --- a/lib/email_parser.rb +++ b/lib/email_parser.rb @@ -1,4 +1,14 @@ -# Build a class EmailAddressParser that accepts a string of unformatted +# Build a class EmailAddressParser 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 (',') # or whitespace (' '). + +class EmailAddressParser + def initialize(addresses) + @addresses = addresses + end + + def parse + @addresses.split(/[\s,]+/).uniq + end +end