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.2.1'

Class Method Summary collapse

Class Method Details

.configObject



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

def config
  return @config if defined?(@config)
  @config = Configuration.new
  @config.len         = 4
  @config.width       = 150
  @config.height      = 48
  @config.implode     = 0.4
  @config.cache_limit = 100
  @config
end

.configure(&block) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/rucaptcha.rb', line 25

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

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