Module: EasyCaptcha
- Defined in:
- lib/easy_captcha.rb,
lib/easy_captcha/captcha.rb,
lib/easy_captcha/version.rb,
lib/easy_captcha/generator.rb,
lib/easy_captcha/controller.rb,
lib/easy_captcha/view_helpers.rb,
lib/easy_captcha/model_helpers.rb,
lib/easy_captcha/generator/base.rb,
lib/easy_captcha/generator/default.rb,
lib/easy_captcha/controller_helpers.rb,
lib/generators/easy_captcha/install_generator.rb
Overview
Captcha-Plugin for Rails
Defined Under Namespace
Modules: ControllerHelpers, Generator, Generators, ModelHelpers, ViewHelpers Classes: Captcha, Controller
Constant Summary collapse
- VERSION =
'0.5.0'
- @@cache =
false
- @@cache_temp_dir =
nil
- @@cache_size =
0
- @@cache_expire =
0
- @@chars =
%w(2 3 4 5 6 7 9 A C D E F G H J K L M N P Q R S T U X Y Z)
- @@length =
6
- @@image_width =
140
- @@image_height =
40
Class Method Summary collapse
-
.cache? ⇒ Boolean
:nodoc:.
-
.generator(generator = nil, &block) ⇒ Object
select generator and configure this.
-
.init ⇒ Object
called by rails after initialize.
-
.method_missing(name, *args) ⇒ Object
depracated.
-
.setup {|_self| ... } ⇒ Object
to configure easy_captcha for a sample look the readme.rdoc file.
Class Method Details
.cache? ⇒ Boolean
:nodoc:
52 53 54 |
# File 'lib/easy_captcha.rb', line 52 def cache? #:nodoc: cache end |
.generator(generator = nil, &block) ⇒ Object
select generator and configure this
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/easy_captcha.rb', line 57 def generator(generator = nil, &block) if generator.nil? @generator else generator = generator.to_s if generator.is_a? Symbol if generator.is_a? String generator.gsub!(/^[a-z]|\s+[a-z]/) { |a| a.upcase } generator = "EasyCaptcha::Generator::#{generator}".constantize end @generator = generator.new &block end end |
.init ⇒ Object
called by rails after initialize
95 96 97 98 99 100 101 102 103 104 |
# File 'lib/easy_captcha.rb', line 95 def init require 'easy_captcha/routes' ActiveRecord::Base.send :include, ModelHelpers ActionController::Base.send :include, ControllerHelpers ActionView::Base.send :include, ViewHelpers # set default generator generator :default end |
.method_missing(name, *args) ⇒ Object
depracated
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/easy_captcha.rb', line 73 def method_missing name, *args name = name.to_s # fix for jruby depracations = [ :font_size, :font_fill_color, :font_family, :font_stroke, :font_stroke_color, :image_background_color, :sketch, :sketch_radius, :sketch_sigma, :wave, :wave_length, :wave_amplitude, :implode, :blur, :blur_radius, :blur_sigma ] if depracations.include? name[0..-2].to_sym or depracations.include? name.to_sym ActiveSupport::Deprecation.warn "EasyCaptcha.#{name} is deprecated." if name[-1,1] == '=' self.generator.send(name, args.first) else self.generator.send(name) end else super end end |
.setup {|_self| ... } ⇒ Object
to configure easy_captcha for a sample look the readme.rdoc file
48 49 50 |
# File 'lib/easy_captcha.rb', line 48 def setup yield self end |