Module: TinyCaptcha

Defined in:
lib/tinycaptcha.rb,
lib/tinycaptcha/version.rb,
lib/tinycaptcha/errors/configuration.rb,
ext/tinycaptcha/tinycaptcha.c

Defined Under Namespace

Modules: Errors

Constant Summary collapse

VERSION =
'1.0.0'

Class Method Summary collapse

Class Method Details

.createObject



215
# File 'ext/tinycaptcha/tinycaptcha.c', line 215

VALUE create(VALUE self, VALUE style, VALUE length, VALUE line, VALUE filter);

.generate(style_sym = :colorful, length = 5, strikethrough = true, outline = false) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tinycaptcha.rb', line 7

def generate(style_sym = :colorful, length=5,  strikethrough=true, outline=false)
  style = style_sym == :colorful ? 1 : 0

  if length < 3 or length > 7
    raise TinyCaptcha::Errors::Configuration, 'length config error, value must in 3..7'
  end

  strikethrough = strikethrough ? 1 : 0
  outline = outline ? 1 : 0
  self.create(style, length, strikethrough, outline)
end