Module: InvisibleCaptcha

Defined in:
lib/invisible_captcha.rb,
lib/invisible_captcha/railtie.rb,
lib/invisible_captcha/version.rb,
lib/invisible_captcha/validator.rb,
lib/invisible_captcha/form_helpers.rb,
lib/invisible_captcha/view_helpers.rb,
lib/invisible_captcha/controller_ext.rb

Defined Under Namespace

Modules: ControllerExt, FormHelpers, ViewHelpers Classes: InvisibleCaptchaValidator, Railtie

Constant Summary collapse

VERSION =
"0.8.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.error_messageObject

Returns the value of attribute error_message.



10
11
12
# File 'lib/invisible_captcha.rb', line 10

def error_message
  @error_message
end

.honeypotsObject

Returns the value of attribute honeypots.



10
11
12
# File 'lib/invisible_captcha.rb', line 10

def honeypots
  @honeypots
end

.sentence_for_humansObject

Returns the value of attribute sentence_for_humans.



10
11
12
# File 'lib/invisible_captcha.rb', line 10

def sentence_for_humans
  @sentence_for_humans
end

.visual_honeypotsObject

Returns the value of attribute visual_honeypots.



10
11
12
# File 'lib/invisible_captcha.rb', line 10

def visual_honeypots
  @visual_honeypots
end

Class Method Details

.get_honeypotObject



30
31
32
# File 'lib/invisible_captcha.rb', line 30

def get_honeypot
  honeypots.sample
end

.init!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/invisible_captcha.rb', line 12

def init!
  # Default sentence for real users if text field was visible
  self.sentence_for_humans = 'If you are a human, ignore this field'

  # Default error message for validator
  self.error_message = 'You are a robot!'

  # Default fake fields for controller based workflow
  self.honeypots = ['foo_id', 'bar_id', 'baz_id']

  # Make honeypots visibles
  self.visual_honeypots = false
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



26
27
28
# File 'lib/invisible_captcha.rb', line 26

def setup
  yield(self) if block_given?
end