Module: Evil::Client::Formatter::Multipart
Overview
Utility module to format file (IO) as a part of multipart body
Instance Method Summary collapse
-
#call(*sources, boundary:) ⇒ String
Formats nested hash as a string.
Instance Method Details
#call(*sources, boundary:) ⇒ String
Formats nested hash as a string
19 20 21 22 23 24 25 |
# File 'lib/evil/client/formatter/multipart.rb', line 19 def call(*sources, boundary:, **) parts = sources.flatten.map.with_index(1) do |src, num| "--#{boundary}\r\n#{part(src, num)}" end [nil, nil, parts, "--#{boundary}--", nil].join("\r\n") end |