module HTTPX::Transcoder::Multipart

  1. lib/httpx/transcoder/multipart.rb
  2. lib/httpx/transcoder/multipart/decoder.rb
  3. lib/httpx/transcoder/multipart/encoder.rb
  4. lib/httpx/transcoder/multipart/mime_type_detector.rb
  5. lib/httpx/transcoder/multipart/part.rb
  6. show all

Methods

Public Instance

  1. encode
  2. multipart?

Constants

MULTIPART_VALUE_COND = lambda do |value| value.respond_to?(:read) || (value.respond_to?(:to_hash) && value.key?(:body) && (value.key?(:filename) || value.key?(:content_type))) end  

Public Instance methods

encode(form_data)
[show source]
   # File lib/httpx/transcoder/multipart.rb
27 def encode(form_data)
28   Encoder.new(form_data)
29 end
multipart?(form_data)
[show source]
   # File lib/httpx/transcoder/multipart.rb
19 def multipart?(form_data)
20   form_data.any? do |_, v|
21     Multipart::MULTIPART_VALUE_COND.call(v) ||
22       (v.respond_to?(:to_ary) && v.to_ary.any?(&Multipart::MULTIPART_VALUE_COND)) ||
23       (v.respond_to?(:to_hash) && v.to_hash.any? { |_, e| Multipart::MULTIPART_VALUE_COND.call(e) })
24   end
25 end