Method: Nele::MsTranslator#parse_response
- Defined in:
- lib/nele/ms_translator.rb
#parse_response(res) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/nele/ms_translator.rb', line 28 def parse_response(res) doc = REXML::Document.new(res) unless doc.elements['string'] = nil doc.elements.each("//p") do |e| str = e[0].to_s if str.index(":") k,v = str.split(":") raise TranslatorAPIError, v.strip if k == "Message" end end else doc.elements['string'][0].to_s end end |