Method: Flatulent#initialize

Defined in:
lib/flatulent.rb

#initialize(arg = {}) ⇒ Flatulent

–{{{



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/flatulent.rb', line 256

def initialize arg = {}   #--{{{
  if Hash === arg
    opt = getopts arg 
    @size = Integer opt[ 'size', 4 ]
    @string = String opt[ 'string', generate_random_string ]
  else
    opt = getopts Hash.new 
    @string = String arg
    @size = @string.size 
  end

  @font = String opt[ 'font', 'big' ]
  @noise = Float opt[ 'noise', 0.05 ]
  @transform = Float opt[ 'transform', 0.03 ]
  @id = String opt[ 'id', 'flatulent' ]
  @action = String opt[ 'action' ]
  @ttl = Integer opt[ 'ttl', 300 ]
  @horizontal_fudge_factor = Integer opt[ 'horizontal_fudge_factor', 4 ]
  @vertical_fudge_factor = Integer opt[ 'vertical_fudge_factor', 4 ]

  @vapour_chars = Integer opt[ 'vapour_chars', 5 * @size ]
  @vapour_level = Float opt[ 'vapour_level', 0.77 ]
  
  figlet!
  vapour!
  captcha!
  element!
  form_tags!
  form!
end