No commit activity in last 3 years
No release in over 3 years
Implementation of Google's ReCAPTCHA Mailhide API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 1.0.0
>= 0
>= 2.11
 Project Readme

ReCAPTCHA Mailhide¶ ↑

This gem provides Ruby (and Rails) support for ReCAPTCHA’s Mailhide API.

<img src=“https://travis-ci.org/pilaf/recaptcha-mailhide.svg?branch=master” alt=“Build Status” />

Installation¶ ↑

Add this to your Gemfile:

gem 'recaptcha-mailhide'

Configuration¶ ↑

Add this somewhere (if you’re using Rails put it in config/initializers/recaptcha_mailhide.rb):

RecaptchaMailhide.configure do |c|
  c.private_key = '...'
  c.public_key  = '...'
end

If you need a set of public/private keys get them from www.google.com/recaptcha/mailhide/apikey

Usage¶ ↑

In Rails views¶ ↑

recaptcha_mailhide('foo@example.com')

You can also provide content as a method argument or a block (just like with link_to):

# Content in argument
recaptcha_mailhide('Click to view email', 'foo@example.com')

recaptcha_mailhide('foo@example.com') do
  # Content here
end

You can also provide options (they get forwarded to link_to):

recaptcha_mailhide('foo@example.com', class: 'hidden-email', target: '_blank')

In addition it accepts a :popup option that will make the link open in a popup window (requires JavaScript):

recaptcha_mailhide('foo@example.com', popup: true)

# Configuring popup window size
recaptcha_mailhide('foo@example.com', popup: { width: 600, height: 600 })

Pure Ruby¶ ↑

Use the following to get just the ReCAPTCHA Mailhide URL (without a link tag):

RecaptchaMailhide.url_for(email)

TODO¶ ↑

  • Tests for Rails helpers

  • Basic helpers (non-dependent on Rails)

  • Rails generator for initializer with auto-fetching of private/public keys

This gem is Copyright © 2012 Pedro Fayolle. See LICENSE.txt for further details.

ReCAPTCHA Mailhide is Copyright © Google, Inc. This is gem is NOT affiliated with Google, Inc.