Module: RuCaptcha

Defined in:
lib/rucaptcha.rb,
lib/rucaptcha/cache.rb,
lib/rucaptcha/engine.rb,
lib/rucaptcha/captcha.rb,
lib/rucaptcha/version.rb,
lib/rucaptcha/view_helpers.rb,
lib/rucaptcha/configuration.rb,
lib/rucaptcha/controller_helpers.rb,
app/controllers/ru_captcha/captcha_controller.rb

Defined Under Namespace

Modules: Cache, ControllerHelpers, ViewHelpers Classes: Captcha, CaptchaController, Configuration, Engine

Constant Summary collapse

VERSION =
'0.3.2'

Class Method Summary collapse

Class Method Details

.configObject



14
15
16
17
18
19
20
21
22
# File 'lib/rucaptcha.rb', line 14

def config
  return @config if defined?(@config)
  @config = Configuration.new
  @config.len         = 4
  @config.font_size   = 45
  @config.implode     = 0.4
  @config.cache_limit = 100
  @config
end

.configure(&block) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rucaptcha.rb', line 24

def configure(&block)
  config.instance_exec(&block)

  if config.width != nil
    ActiveSupport::Deprecation.warn("RuCaptcha config.width will remove in 0.4.0")
  end

  if config.height != nil
    ActiveSupport::Deprecation.warn("RuCaptcha config.height will remove in 0.4.0")
  end

  # enable cache if cache_limit less than 1
  if config.cache_limit >= 1
    RuCaptcha::Captcha.send(:include, RuCaptcha::Cache)
  end
end