Class: Net::HTTP::Post::ParamPart
- Inherits:
-
Object
- Object
- Net::HTTP::Post::ParamPart
- Includes:
- Part
- Defined in:
- lib/net/http/post/multipart.rb
Overview
Represents a part to be filled with a string name/value pair.
Instance Method Summary collapse
- #build_part(boundary, name, value) ⇒ Object
-
#initialize(boundary, name, value) ⇒ ParamPart
constructor
A new instance of ParamPart.
Methods included from Part
Constructor Details
#initialize(boundary, name, value) ⇒ ParamPart
Returns a new instance of ParamPart.
36 37 38 39 |
# File 'lib/net/http/post/multipart.rb', line 36 def initialize(boundary, name, value) @part = build_part(boundary, name, value) @io = StringIO.new(@part) end |
Instance Method Details
#build_part(boundary, name, value) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/net/http/post/multipart.rb', line 41 def build_part(boundary, name, value) part = '' part << "--#{boundary}\r\n" part << "Content-Disposition: form-data; name=\"#{name.to_s}\"\r\n" part << "\r\n" part << "#{value}\r\n" end |