Module: Datadog::Core::Vendor::Multipart::Post::Parts::Part
- Included in:
- EpiloguePart, FilePart, ParamPart
- Defined in:
- lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.file?(value) ⇒ Boolean
23 24 25 |
# File 'lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb', line 23 def self.file?(value) value.respond_to?(:content_type) && value.respond_to?(:original_filename) end |
.new(boundary, name, value, headers = {}) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb', line 14 def self.new(boundary, name, value, headers = {}) headers ||= {} # avoid nil values if file?(value) FilePart.new(boundary, name, value, headers) else ParamPart.new(boundary, name, value, headers) end end |
Instance Method Details
#length ⇒ Object
27 28 29 |
# File 'lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb', line 27 def length @part.length end |
#to_io ⇒ Object
31 32 33 |
# File 'lib/datadog/core/vendor/multipart-post/multipart/post/parts.rb', line 31 def to_io @io end |