Module: Nlpcaptcha

Defined in:
lib/nlpcaptcha.rb,
lib/nlpcaptcha/verify.rb,
lib/nlpcaptcha/version.rb,
lib/nlpcaptcha/client_helper.rb,
lib/nlpcaptcha/configuration.rb

Defined Under Namespace

Modules: ClientHelper, Verify Classes: Configuration, NlpcaptchaError

Constant Summary collapse

NLPCAPTCHA_JS_URL =
'http://call.nlpcaptcha.in/js/captcha.js'
NLPCAPTCHA_VALIDATE_URL =
'http://call.nlpcaptcha.in/index.php/ad/validate'
SKIP_VERIFY_ENV =
['test', 'cucumber']
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.configurationObject

Gives access to the current Configuration.



13
14
15
# File 'lib/nlpcaptcha.rb', line 13

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Allows easy setting of multiple configuration options. See Configuration for all available options. – The temp assignment is only used to get a nicer rdoc. Feel free to remove this hack. ++

Yields:

  • (config)


23
24
25
26
# File 'lib/nlpcaptcha.rb', line 23

def self.configure
  config = configuration
  yield(config)
end

.with_configuration(config) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/nlpcaptcha.rb', line 28

def self.with_configuration(config)
  original_config = {}

  config.each do |key, value|
    original_config[key] = configuration.send(key)
    configuration.send("#{key}=", value)
  end

  result = yield if block_given?

  original_config.each { |key, value| configuration.send("#{key}=", value) }
  result
end