Sha256: a2b28a3fdfd5300494f68405c02675cef81fd8f0421ae337c209c02af85e32b4
Contents?: true
Size: 995 Bytes
Versions: 1
Compression:
Stored size: 995 Bytes
Contents
require 'digest/sha1' module SoaringSimpleCaptcha #:nodoc module Utils #:nodoc # Execute command with params and return output if exit status equal expected_outcodes def self.run(cmd, params = "", expected_outcodes = 0) command = %Q[#{cmd} #{params}].gsub(/\s+/, " ") command = "#{command} 2>&1" unless (image_magick_path = SoaringSimpleCaptcha.image_magick_path).blank? command = File.join(image_magick_path, command) end output = `#{command}` unless [expected_outcodes].flatten.include?($?.exitstatus) raise ::StandardError, "Error while running #{cmd}: #{output}" end output end def self.simple_captcha_value(key) #:nodoc SimpleCaptchaData.get_data(key).value rescue nil end def self.simple_captcha_passed!(key) #:nodoc SimpleCaptchaData.remove_data(key) end def self.generate_key(*args) args << Time.now.to_s Digest::SHA1.hexdigest(args.join) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
soaring_simple_captcha-0.1.6 | lib/soaring_simple_captcha/utils.rb |