Contact Parser Exercise in Ruby
In this guide you will learn how to parse emails by first name, last name and email.
Guide Tasks
- Read Tutorial
- Complete the Exercise
Summary
Build out a class for building a bulk contact parser.
Exercise Description
"Define a class That can parse emails by first and last name and email when in a specific format"
Example Data
'contacts = "Darth Vader <darth@vader.com>, Oops Sanderson <oops@gmail>, Han Solo <han@solo.com>, Mace X Windu <mace@windu.com>, Yoda <yoda@lightsaber.com>, Leia Organa leia@organa.com" ' -> expect(ContactParser.new(contacts).bulk_parse).to eq( { accepted: [ { first_name: 'Darth', last_name: 'Vader', email: 'darth@vader.com' }, { first_name: 'Han', last_name: 'Solo', email: 'han@solo.com' }, { first_name: 'Mace', last_name: 'Windu', email: 'mace@windu.com' }, { first_name: 'Leia', last_name: 'Organa', email: 'leia@organa.com' } ], rejected: [ 'Oops Sanderson oops@gmail', 'Yoda yoda@lightsaber.com' ] } )
Real World Usage
This exercise will help you be able to sort through specific data and organize it in a specific way.