Class: RBC

Inherits:
Object
  • Object
show all
Defined in:
lib/rbCaptcha.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cwordsObject (readonly)

Returns the value of attribute cwords.



6
7
8
# File 'lib/rbCaptcha.rb', line 6

def cwords
  @cwords
end

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/rbCaptcha.rb', line 6

def data
  @data
end

#mwObject (readonly)

Returns the value of attribute mw.



6
7
8
# File 'lib/rbCaptcha.rb', line 6

def mw
  @mw
end

#mw0Object (readonly)

Returns the value of attribute mw0.



6
7
8
# File 'lib/rbCaptcha.rb', line 6

def mw0
  @mw0
end

#truewObject (readonly)

Returns the value of attribute truew.



6
7
8
# File 'lib/rbCaptcha.rb', line 6

def truew
  @truew
end

#wordsObject (readonly)

Returns the value of attribute words.



6
7
8
# File 'lib/rbCaptcha.rb', line 6

def words
  @words
end

Instance Method Details

#crun(data) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rbCaptcha.rb', line 8

def crun(data)

    words = [
            '29183!с92-3822a29!``~39t', # => cat
            '38134@3#2d392o1911!!(@)O!!!#g', # => dog
            '3928937h392!@(o)303m39---e'    # => home
            ]

    cword = words.sample
    
    if cword == words[0]
            truew = 'cat'
    elsif cword == words[1]
            truew = 'dog'
    elsif cword == words[2]
            truew = 'home'
    end

    puts "Please, to continue, write a word that is written in lowercase letters.\n    #{cword}"
    
    mw0 = gets.chomp 
    mw = mw0.downcase
    if mw == truew
            puts "You have passed the captcha sir."
            return true
    else
            puts "You didn't pass the captcha, try again."
            return false
    end
        
    sleep(data)
end