module Captcher
Constants
- VERSION
Public Instance Methods
captcha_class()
click to toggle source
# File lib/captcher.rb, line 25 def captcha_class @captcha_class ||= select_captcha_class(Captcher.config[:mode]) end
config()
click to toggle source
# File lib/captcher.rb, line 21 def config default_config.merge(@config) end
configure() { |config| ... }
click to toggle source
# File lib/captcher.rb, line 15 def configure @config = Captcher::Config.new yield(@config) self end
select_captcha_class(name)
click to toggle source
# File lib/captcher.rb, line 29 def select_captcha_class(name) klass = name.to_s.camelize "Captcher::Captchas::#{klass}".constantize end
Private Instance Methods
default_config()
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/captcher.rb, line 37 def default_config @default_config ||= Captcher::Config.new do |c| c.mode = :cached_captcha c.code_captcha do |cc| cc.fonts Dir[Captcher::Engine.root.join("lib/fonts/**")] cc.font_size 50 cc.font_color "black" cc.count 5 cc.background "#999999" cc.format "png" end c.cached_captcha do |cc| cc.slots_count 10 cc.wrapped :code_captcha end c.math_captcha do |mc| end c.awesome_captcha do |ac| end end end