title: Ruby/Rails Parsing Emails
body: <p>I'm currently using the following to parse emails:</p>
  
  <pre><code>  def parse_emails(emails)
      valid_emails, invalid_emails = [], []
      unless emails.nil?
        emails.split(/, ?/).each do |full_email|
          unless full_email.blank?
            if full_email.index(/\&lt;.+\&gt;/)
              email = full_email.match(/\&lt;.*\&gt;/)[0].gsub(/[\&lt;\&gt;]/, "").strip
            else
              email = full_email.strip
            end
            email = email.delete("&lt;").delete("&gt;")
            email_address = EmailVeracity::Address.new(email)
            if email_address.valid?
              valid_emails &lt;&lt; email 
            else
              invalid_emails &lt;&lt; email
            end
          end
        end                    
      end
      return valid_emails, invalid_emails
    end
  </code></pre>
  
  <p>The problem I'm having is given an email like:</p>
  
  <pre><code>Bob Smith &lt;bob@smith.com&gt;
  </code></pre>
  
  <p>The code above is delete Bob Smith and only returning bob@smith.</p>
  
  <p>But what I want is an hash of FNAME, LNAME, EMAIL. Where fname and lname are optional but email is not.</p>
  
  <p>What type of ruby object would I use for that and how would I create such a record in the code above?</p>
  
  <p>Thanks</p>