forked from learn-co-students/oo-email-parser-v-000
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea555f0
commit 780d991
Showing
1 changed file
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
# Build a class EmailParser that accepts a string of unformatted | ||
# 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 (',') | ||
# or whitespace (' '). | ||
|
||
class EmailParser | ||
attr_accessor :emails | ||
|
||
def initialize(email) #using initialize, want the new object to have initial data before we add behavior | ||
@emails = email#sets local variable email to an instance variable | ||
end | ||
|
||
def parse | ||
emails.delete(",").split.uniq | ||
end | ||
|
||
end |