Class: Parts::ParamPart
- Includes:
- Part
- Defined in:
- lib/puppet/feature/parts.rb
Instance Method Summary collapse
- #build_part(boundary, name, value, headers = {}) ⇒ Object
-
#initialize(boundary, name, value, headers = {}) ⇒ ParamPart
constructor
A new instance of ParamPart.
- #length ⇒ Object
Methods included from Part
Constructor Details
#initialize(boundary, name, value, headers = {}) ⇒ ParamPart
Returns a new instance of ParamPart.
33 34 35 36 |
# File 'lib/puppet/feature/parts.rb', line 33 def initialize(boundary, name, value, headers = {}) @part = build_part(boundary, name, value, headers) @io = StringIO.new(@part) end |
Instance Method Details
#build_part(boundary, name, value, headers = {}) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/puppet/feature/parts.rb', line 42 def build_part(boundary, name, value, headers = {}) part = '' part << "--#{boundary}\r\n" part << "Content-Disposition: form-data; name=\"#{name.to_s}\"\r\n" part << "Content-Type: #{headers["Content-Type"]}\r\n" if headers["Content-Type"] part << "\r\n" part << "#{value}\r\n" end |
#length ⇒ Object
38 39 40 |
# File 'lib/puppet/feature/parts.rb', line 38 def length @part.bytesize end |