class Hurley::Multipart::ParamPart

Constants

CTYPE_FORMAT
PART_FORMAT

Public Class Methods

new(boundary, name, value, header) click to toggle source
# File lib/hurley/multipart.rb, line 81
def initialize(boundary, name, value, header)
  @part = build_part(boundary, name, value, header)
  @io = StringIO.new(@part)
end

Public Instance Methods

length() click to toggle source
# File lib/hurley/multipart.rb, line 86
def length
  @part.bytesize
end

Private Instance Methods

build_part(boundary, name, value, header) click to toggle source
# File lib/hurley/multipart.rb, line 92
def build_part(boundary, name, value, header)
  ctype = if type = header[:content_type]
    CTYPE_FORMAT % type
  end

  PART_FORMAT % [
    boundary,
    name.to_s,
    ctype,
    value.to_s,
  ]
end