# -*- encoding : utf-8 -*- module TinyCaptcha autoload :Utils, 'tiny_captcha/utils' autoload :ImageHelpers, 'tiny_captcha/image' autoload :ViewHelper, 'tiny_captcha/view' autoload :ControllerHelpers, 'tiny_captcha/controller' autoload :FormBuilder, 'tiny_captcha/form_builder' autoload :CustomFormBuilder, 'tiny_captcha/formtastic' if defined?(ActiveRecord) autoload :ModelHelpers, 'tiny_captcha/active_record' autoload :TinyCaptchaData, 'tiny_captcha/tiny_captcha_data' else autoload :TinyCaptchaData, 'tiny_captcha/tiny_captcha_data_mongoid.rb' end autoload :Middleware, 'tiny_captcha/middleware' mattr_accessor :image_size @@image_size = "100x28" mattr_accessor :length @@length = 6 # 'embosed_silver', # 'simply_red', # 'simply_green', # 'simply_blue', # 'distorted_black', # 'all_black', # 'charcoal_grey', # 'almost_invisible' # 'random' mattr_accessor :image_style @@image_style = 'simply_blue' # 'low', 'medium', 'high', 'random' mattr_accessor :distortion @@distortion = 'low' # command path mattr_accessor :image_magick_path @@image_magick_path = '' # tmp directory mattr_accessor :tmp_path @@tmp_path = nil mattr_accessor :image_show_path @@image_show_path = '/tiny_captcha/images/show' def self.add_image_style(name, params = []) ::TinyCaptcha::ImageHelpers.image_styles.update(name.to_s => params) end def self.setup yield self end end I18n.load_path += Dir[Pathname.new(__FILE__).join('..', '..', 'config', 'locales', '**', '*.{rb,yml}').to_s] require 'tiny_captcha/engine' if defined?(Rails)