Class: Parts::ParamPart
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.
22 23 24 25 |
# File 'lib/parts.rb', line 22 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
27 28 29 30 31 32 33 |
# File 'lib/parts.rb', line 27 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 |