Module: Awestruct::Extensions::Obfuscate
- Defined in:
- lib/awestruct/extensions/obfuscate.rb
Instance Method Summary collapse
Instance Method Details
#mail_to(email, options = {}) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/awestruct/extensions/obfuscate.rb', line 5 def mail_to(email, ={}) index = email.index('@') or raise "email needs to contain @" index += 3 parts = [ email[0...index], email[index..-1] ] "<a\nclass='#{[:class]}\nhref=\"mailto:x@y\"\n'\nhref\n = '#{hex('mailto:' + percent(email))}\n'>#{hex(parts[0])}<!--\nmailto:[email protected]\n</a>\n-->#{hex(parts[1])}</a>" end |