Method: Cyc::Client#receive_raw_answer

Defined in:
lib/cyc/client.rb

#receive_raw_answer(options = {}) ⇒ Object

Receives raw answer from server. If a block is given the answer is yield to the block, otherwise the answer is returned.



226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/cyc/client.rb', line 226

def receive_raw_answer(options={})
  status, answer, last_message = connection{|c| c.read}
  puts "Recv: #{last_message} -> #{status} #{answer}" if @debug
  if status == 200
    if block_given?
      yield answer, last_message
    else
      return answer
    end
  else
    raise CycError.new(answer.sub(/^"/,"").sub(/"$/,"") + "\n" + last_message)
  end
end