Module: Captcher

Extended by:
Captcher
Included in:
Captcher
Defined in:
lib/captcher.rb,
lib/captcher/config.rb,
lib/captcher/engine.rb,
lib/captcher/version.rb,
lib/captcher/text_image.rb,
lib/captcher/base_captcha.rb,
lib/captcher/captchas/code_captcha.rb,
lib/captcher/captchas/math_captcha.rb,
lib/captcher/captchas/cached_captcha.rb,
lib/captcher/captchas/awesome_captcha.rb,
app/helpers/captcher/application_helper.rb,
app/controllers/captcher/captchas_controller.rb,
app/controllers/concerns/captcher/captcha_aware.rb

Defined Under Namespace

Modules: ApplicationHelper, CaptchaAware, Captchas Classes: BaseCaptcha, CaptchasController, Config, Engine, TextImage

Constant Summary collapse

VERSION =
"0.3.1".freeze

Instance Method Summary collapse

Instance Method Details

#captcha_classObject



25
26
27
# File 'lib/captcher.rb', line 25

def captcha_class
  @captcha_class ||= select_captcha_class(Captcher.config[:mode])
end

#configObject



21
22
23
# File 'lib/captcher.rb', line 21

def config
  default_config.merge(@config)
end

#configure {|@config| ... } ⇒ Object

Yields:



15
16
17
18
19
# File 'lib/captcher.rb', line 15

def configure
  @config = Captcher::Config.new
  yield(@config)
  self
end

#select_captcha_class(name) ⇒ Object



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

def select_captcha_class(name)
  klass = name.to_s.camelize
  "Captcher::Captchas::#{klass}".constantize
end