I am using Ruby on Rails v3.0.9 and I am finding the best way to retrieve the “last part” of a email string and the related web site URL (that is, the web site that provides the email service).
For example, if I have
sample_email_title@gmail.com
I would like to retrieve
gmail.com
and “transform” that so to have the following:
http://www.gmail.com
How can I accomplish that?
You could do something like this:
You could do it all in one line with:
There may be better ways, but this is fairly simple.