Methods
Attributes
[RW] charset
[RW] chunk_size
[RW] date
[RW] type
Public Class methods
new(body = nil, date = nil, type = nil, charset = nil, boundary = nil)
# File lib/facets/more/http.rb, line 318
      def initialize(body = nil, date = nil, type = nil, charset = nil,
          boundary = nil)
        @body = nil
        @boundary = boundary
        set_content(body || '', boundary)
        @type = type
        @charset = charset
        @date = date
        @chunk_size = 4096
      end
Public Instance methods
content()
# File lib/facets/more/http.rb, line 354
      def content
        @body
      end
dump(dev = '')
# File lib/facets/more/http.rb, line 337
      def dump(dev = '')
        if @body.respond_to?(:read)
          begin
            while true
              chunk = @body.read(@chunk_size)
              break if chunk.nil?
              dev << dump_chunk(chunk)
            end
          rescue EOFError
          end
          dev << (dump_last_chunk + CRLF)
        else
          dev << @body
        end
        dev
      end
set_content(body, boundary = nil)
# File lib/facets/more/http.rb, line 358
      def set_content(body, boundary = nil)
        if body.respond_to?(:read)
          @body = body
        elsif boundary
          @body = Message.create_query_multipart_str(body, boundary)
        else
          @body = Message.create_query_part_str(body)
        end
      end
size()
# File lib/facets/more/http.rb, line 329
      def size
        if @body.respond_to?(:read)
          nil
        else
          @body.size
        end
      end
Private Instance methods
dump_chunk(str)
# File lib/facets/more/http.rb, line 370
      def dump_chunk(str)
        dump_chunk_size(str.size) << (str + CRLF)
      end
dump_chunk_size(size)
# File lib/facets/more/http.rb, line 378
      def dump_chunk_size(size)
        sprintf("%x", size) << CRLF
      end
dump_last_chunk()
# File lib/facets/more/http.rb, line 374
      def dump_last_chunk
        dump_chunk_size(0)
      end