# File lib/dnsruby/message/message.rb, line 410
    def to_s
      s = ''  # the output string to return

      if @answerfrom && (! @answerfrom.empty?)
        s << ";; Answer received from #{@answerfrom} (#{@answersize} bytes)\n;;\n"
      end

      s << ";; Security Level : #{@security_level.string}\n"

      #  OPT pseudosection? EDNS flags, udpsize
      opt = get_opt

      if opt
        s << @header.to_s_with_rcode(rcode) << "\n#{opt}\n"
      else
        s << "#{@header}\n"
      end

      section = (@header.opcode == OpCode.UPDATE) ? 'ZONE' : 'QUESTION'
      s <<  ";; #{section} SECTION (#{@header.qdcount}  record#{@header.qdcount == 1 ? '' : 's'})\n"
      each_question { |qr| s << ";; #{qr}\n" }

      if @answer.size > 0
        s << "\n"
        section = (@header.opcode == OpCode.UPDATE) ? 'PREREQUISITE' : 'ANSWER'
        s << ";; #{section} SECTION (#{@header.ancount}  record#{@header.ancount == 1 ? '' : 's'})\n"
        each_answer { |rr| s << "#{rr}\n" }
      end

      if @authority.size > 0
        s << "\n"
        section = (@header.opcode == OpCode.UPDATE) ? 'UPDATE' : 'AUTHORITY'
        s << ";; #{section} SECTION (#{@header.nscount}  record#{@header.nscount == 1 ? '' : 's'})\n"
        each_authority { |rr| s << rr.to_s + "\n" }
      end

      if (@additional.size > 0 && !opt) || (@additional.size > 1)
        s << "\n;; ADDITIONAL SECTION (#{@header.arcount}  record#{@header.arcount == 1 ? '' : 's'})\n"
        each_additional { |rr|
          if rr.type != Types::OPT
            s << rr.to_s+ "\n"
          end
        }
      end

      s
    end