Parent

Methods

Files

HTTP::Message::Body::Parts

Attributes

size[R]

Public Class Methods

new() click to toggle source
     # File lib/httpclient/http.rb, line 534
534:         def initialize
535:           @body = []
536:           @size = 0
537:           @as_stream = false
538:         end

Public Instance Methods

add(part) click to toggle source
     # File lib/httpclient/http.rb, line 540
540:         def add(part)
541:           if Message.file?(part)
542:             @as_stream = true
543:             @body << part
544:             if part.respond_to?(:size)
545:               if sz = part.size
546:                 @size += sz
547:               else
548:                 @size = nil
549:               end
550:             elsif part.respond_to?(:lstat)
551:               @size += part.lstat.size
552:             else
553:               # use chunked upload
554:               @size = nil
555:             end
556:           elsif @body[1].is_a?(String)
557:             @body[1] += part.to_s
558:             @size += part.to_s.size if @size
559:           else
560:             @body << part.to_s
561:             @size += part.to_s.size if @size
562:           end
563:         end
parts() click to toggle source
     # File lib/httpclient/http.rb, line 565
565:         def parts
566:           if @as_stream
567:             @body
568:           else
569:             [@body.join]
570:           end
571:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.