Module: Kamcaptcha::Token

Defined in:
lib/kamcaptcha/token.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.generatorObject

Returns the value of attribute generator.



4
5
6
# File 'lib/kamcaptcha/token.rb', line 4

def generator
  @generator
end

.lookupObject

Returns the value of attribute lookup.



4
5
6
# File 'lib/kamcaptcha/token.rb', line 4

def lookup
  @lookup
end

.storeObject

Returns the value of attribute store.



4
5
6
# File 'lib/kamcaptcha/token.rb', line 4

def store
  @store
end

Class Method Details

.valid?(validation, input) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
# File 'lib/kamcaptcha/token.rb', line 6

def valid?(validation, input)
  input = Kamcaptcha.encrypt(input.to_s.delete(" ").downcase)
  input = instance_exec(input, &generator) if generator

  input == validation
end