Class: OCR::Weocr
Instance Attribute Summary collapse
-
#outputencoding ⇒ Object
Returns the value of attribute outputencoding.
-
#server_cgi ⇒ Object
Returns the value of attribute server_cgi.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#servers_info ⇒ Object
Returns the value of attribute servers_info.
Attributes inherited from Ocr
#debug, #error, #extra_login_data, #file, #format, #language, #outputfile, #password, #proxy_addr, #proxy_pass, #proxy_port, #proxy_user, #rescue_exceptions, #text, #username
Attributes inherited from Factory
Instance Method Summary collapse
Methods inherited from Ocr
#error?, #initialize, #login, #outputfile?, #proxy, #recognize, #rescue_exceptions?
Methods inherited from Factory
Constructor Details
This class inherits a constructor from OCR::Ocr
Instance Attribute Details
#outputencoding ⇒ Object
Returns the value of attribute outputencoding.
8 9 10 |
# File 'lib/ocrs/weocr.rb', line 8 def outputencoding @outputencoding end |
#server_cgi ⇒ Object
Returns the value of attribute server_cgi.
8 9 10 |
# File 'lib/ocrs/weocr.rb', line 8 def server_cgi @server_cgi end |
#servers ⇒ Object
Returns the value of attribute servers.
8 9 10 |
# File 'lib/ocrs/weocr.rb', line 8 def servers @servers end |
#servers_info ⇒ Object
Returns the value of attribute servers_info.
8 9 10 |
# File 'lib/ocrs/weocr.rb', line 8 def servers_info @servers_info end |
Instance Method Details
#ocr_servers ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ocrs/weocr.rb', line 10 def ocr_servers @servers = [] @servers_info = {} # Get OCR servers url = 'http://weocr.ocrgrid.org/cgi-bin/weocr/search.cgi?lang=&fmt=xml' xml_data = Net::HTTP.get(URI.parse(url)) doc = REXML::Document.new(xml_data) doc.elements.each('weocrlist/server/url') do |ele| @servers << ele.text end return unless @servers.count > 0 xml_data = Net::HTTP.get(URI.parse("#{@servers[0]}srvspec.xml")) doc = REXML::Document.new(xml_data) doc.elements.each('ocrserver/svinfo/cgi') do |ele| @server_cgi = ele.text end end |