Class: HTTP::FormData::Part
- Inherits:
-
Object
- Object
- HTTP::FormData::Part
- Includes:
- Readable
- Defined in:
- lib/http/form_data/part.rb
Overview
Represents a body part of multipart/form-data request.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#content_type ⇒ String?
readonly
Returns the content type of this part.
-
#filename ⇒ String?
readonly
Returns the filename of this part.
Instance Method Summary collapse
-
#initialize(body, content_type: nil, filename: nil) ⇒ Part
constructor
Creates a new Part with the given body and options.
Methods included from Readable
Constructor Details
#initialize(body, content_type: nil, filename: nil) ⇒ Part
Creates a new Part with the given body and options
45 46 47 48 49 |
# File 'lib/http/form_data/part.rb', line 45 def initialize(body, content_type: nil, filename: nil) @io = StringIO.new(body.to_s) @content_type = content_type @filename = filename end |
Instance Attribute Details
#content_type ⇒ String? (readonly)
Returns the content type of this part
25 26 27 |
# File 'lib/http/form_data/part.rb', line 25 def content_type @content_type end |
#filename ⇒ String? (readonly)
Returns the filename of this part
34 35 36 |
# File 'lib/http/form_data/part.rb', line 34 def filename @filename end |