Module: EasyCaptcha

Defined in:
lib/easy_captcha.rb,
lib/easy_captcha/captcha.rb,
lib/easy_captcha/controller.rb,
lib/easy_captcha/view_helpers.rb,
lib/easy_captcha/model_helpers.rb,
lib/easy_captcha/controller_helpers.rb

Overview

Captcha-Plugin for Rails

Defined Under Namespace

Modules: ControllerHelpers, ModelHelpers, ViewHelpers Classes: Captcha, Controller

Constant Summary collapse

@@cache =
true
@@cache_temp_dir =
Rails.root + 'tmp' + 'captchas'
@@cache_size =
500
@@cache_expire =
1.days
@@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
@@font_size =
24
@@font_fill_color =
'#333333'
@@font_family =
File.expand_path('../../../resources/captcha.ttf', __FILE__)
@@font_stroke =
'#000000'
@@font_stroke_color =
0
@@image_width =
140
@@image_height =
40
@@image_background_color =
'#FFFFFF'
@@sketch =
true
@@sketch_radius =
3
@@sketch_sigma =
1
@@wave =
true
@@wave_length =
(60..100)
@@wave_amplitude =
(3..5)
@@implode =
0.05
@@blur =
true
@@blur_radius =
1
@@blur_sigma =
2

Class Method Summary collapse

Class Method Details

.blur?Boolean

:nodoc:

Returns:

  • (Boolean)


82
83
84
# File 'lib/easy_captcha.rb', line 82

def blur? #:nodoc:
  blur
end

.cache?Boolean

:nodoc:

Returns:

  • (Boolean)


86
87
88
# File 'lib/easy_captcha.rb', line 86

def cache? #:nodoc:
  cache
end

.initObject

called by rails after initialize



91
92
93
94
95
# File 'lib/easy_captcha.rb', line 91

def init
  ActiveRecord::Base.send :include, ModelHelpers
  ActionController::Base.send :include, ControllerHelpers
  ActionView::Base.send :include, ViewHelpers
end

.setup {|_self| ... } ⇒ Object

to configure easy_captcha for a sample look the readme.rdoc file

Yields:

  • (_self)

Yield Parameters:

  • _self (EasyCaptcha)

    the object that the method was called on



70
71
72
# File 'lib/easy_captcha.rb', line 70

def setup
  yield self
end

.sketch?Boolean

:nodoc:

Returns:

  • (Boolean)


74
75
76
# File 'lib/easy_captcha.rb', line 74

def sketch? #:nodoc:
  sketch
end

.wave?Boolean

:nodoc:

Returns:

  • (Boolean)


78
79
80
# File 'lib/easy_captcha.rb', line 78

def wave? #:nodoc:
  wave
end