Sha256: 95ba65e39b3ddd9d8aa8fe350c7cdb8c276a4fc4415a487b1bf60c4ef7acee5b

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

# Include
require 'rubygems'
require 'active_support'
require 'rmagick_captcha/model_additions'
require 'rmagick_captcha/controller_additions'
require 'rmagick_captcha/view_additions'
# require backends
require 'rmagick_captcha/rmagick_backend'

module RmagickCaptcha
  # default options that can be overridden on the global level
  @@options = {
    :controller         => "rmagick_captcha",                           #
    :action             => "show",                                      #
    :id                 => "id",                                        #
    :captcha_key_len    => 4,                                           #
    :case_sensitive     => true,                                        #
    :random_chars       => "ABCDEFGHJKLMNPQRSTUVWXYZ" + "0123456789",   #
    :random_colors      => ["red", "blue", "green", "gray", "pink"],    #
    :img_format         => "png",                                       #
    :gc_width           => 200,                                         #
    :gc_height          => 100,                                         #
    :font_family        => "times",                                     #
  }
  mattr_reader :options

  def self.enable_activerecord
    ActiveRecord::Base.send :include, RmagickCaptcha::ModelAdditions
    ActiveRecord::Base.send :extend, RmagickCaptcha::ModelAdditions::ClassMethods
  end

  def self.enable_actionpack
    ActionController::Base.send :include, RmagickCaptcha::ControllerAdditions
    ActionController::Base.send :extend, RmagickCaptcha::ControllerAdditions::ClassMethods
    ActionView::Base.send :include, RmagickCaptcha::ViewAdditions
  end
end

if defined? Rails
  RmagickCaptcha.enable_activerecord if defined? ActiveRecord
  RmagickCaptcha.enable_actionpack if defined? ActionController
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rmagick_captcha-0.6.4 lib/rmagick_captcha.rb