Class: OCR::Ocr
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#extra_login_data ⇒ Object
Returns the value of attribute extra_login_data.
-
#file ⇒ Object
Returns the value of attribute file.
-
#format ⇒ Object
Returns the value of attribute format.
-
#language ⇒ Object
Returns the value of attribute language.
-
#outputfile ⇒ Object
Returns the value of attribute outputfile.
-
#password ⇒ Object
Returns the value of attribute password.
-
#proxy_addr ⇒ Object
Returns the value of attribute proxy_addr.
-
#proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
-
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
-
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#username ⇒ Object
Returns the value of attribute username.
Attributes inherited from Factory
Instance Method Summary collapse
- #error? ⇒ Boolean
- #init ⇒ Object
-
#initialize(*args) ⇒ Ocr
constructor
A new instance of Ocr.
- #login(username, password, extra_login_data = false) ⇒ Object
- #outputfile? ⇒ Boolean
- #proxy(p_addr, p_port = nil, p_user = nil, p_pass = nil) ⇒ Object
- #recognize ⇒ Object
Methods inherited from Factory
Constructor Details
#initialize(*args) ⇒ Ocr
Returns a new instance of Ocr.
13 14 15 |
# File 'lib/ocr/ocr.rb', line 13 def initialize(*args) init end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
11 12 13 |
# File 'lib/ocr/ocr.rb', line 11 def debug @debug end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/ocr/ocr.rb', line 7 def error @error end |
#extra_login_data ⇒ Object
Returns the value of attribute extra_login_data.
8 9 10 |
# File 'lib/ocr/ocr.rb', line 8 def extra_login_data @extra_login_data end |
#file ⇒ Object
Returns the value of attribute file.
10 11 12 |
# File 'lib/ocr/ocr.rb', line 10 def file @file end |
#format ⇒ Object
Returns the value of attribute format.
10 11 12 |
# File 'lib/ocr/ocr.rb', line 10 def format @format end |
#language ⇒ Object
Returns the value of attribute language.
10 11 12 |
# File 'lib/ocr/ocr.rb', line 10 def language @language end |
#outputfile ⇒ Object
Returns the value of attribute outputfile.
10 11 12 |
# File 'lib/ocr/ocr.rb', line 10 def outputfile @outputfile end |
#password ⇒ Object
Returns the value of attribute password.
8 9 10 |
# File 'lib/ocr/ocr.rb', line 8 def password @password end |
#proxy_addr ⇒ Object
Returns the value of attribute proxy_addr.
9 10 11 |
# File 'lib/ocr/ocr.rb', line 9 def proxy_addr @proxy_addr end |
#proxy_pass ⇒ Object
Returns the value of attribute proxy_pass.
9 10 11 |
# File 'lib/ocr/ocr.rb', line 9 def proxy_pass @proxy_pass end |
#proxy_port ⇒ Object
Returns the value of attribute proxy_port.
9 10 11 |
# File 'lib/ocr/ocr.rb', line 9 def proxy_port @proxy_port end |
#proxy_user ⇒ Object
Returns the value of attribute proxy_user.
9 10 11 |
# File 'lib/ocr/ocr.rb', line 9 def proxy_user @proxy_user end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
7 8 9 |
# File 'lib/ocr/ocr.rb', line 7 def text @text end |
#username ⇒ Object
Returns the value of attribute username.
8 9 10 |
# File 'lib/ocr/ocr.rb', line 8 def username @username end |
Instance Method Details
#error? ⇒ Boolean
42 43 44 |
# File 'lib/ocr/ocr.rb', line 42 def error? @error != false end |
#init ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ocr/ocr.rb', line 17 def init clear_error clear_text login false, false proxy false file= false lang= false format= false outputfile= false debug= false end |
#login(username, password, extra_login_data = false) ⇒ Object
29 30 31 32 33 |
# File 'lib/ocr/ocr.rb', line 29 def login username, password, extra_login_data = false @username = username @password = password @extra_login_data = extra_login_data end |
#outputfile? ⇒ Boolean
46 47 48 |
# File 'lib/ocr/ocr.rb', line 46 def outputfile? outputfile != false end |
#proxy(p_addr, p_port = nil, p_user = nil, p_pass = nil) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/ocr/ocr.rb', line 35 def proxy p_addr, p_port = nil, p_user = nil, p_pass = nil @proxy_addr = p_addr @proxy_port = p_port @proxy_user = p_user @proxy_pass = p_pass end |
#recognize ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/ocr/ocr.rb', line 50 def recognize clear_error clear_text return false && set_error("No file") if @file.nil? return false && set_error("File not exists '#{@file}'") unless File.exist?(@file) ocr_recognize end |