Hi -
I’m not sure it answers your question (it is not a gem, after all), but I use the following code in config.rb
# obfuscate a mail address "email"
# optional argument "string" is the text to show on the webpage
#
# Adapted from:
# http://stackoverflow.com/questions/483212/effective-method-to-hide-email-from-spam-bots
#
MAIL_TO = 'mailto:'
AT = '@'
DOT = '.'
def mailto email="user@example.com", string=“contact me”
comp = email.split("@")
# process string, if it is an email address
if string.include?("@") then
string.gsub!("@", AT + "‌").gsub!(".", DOT)
end
%|<a href="my email when you click"
rel="nofollow"
onclick="str1='#{comp[0]}';str2='#{comp[1]}';this.href='#{MAIL_TO}' + str1 + '@' + str2">#{string}</a>|
end
and then, in the views:
<%= mailto "info@example.com", "send me an mail" %>
concerning the robustness of the obfuscation, plase refer to the stackoverflow post where the obfuscation code is taken from.