fixing usage of Enumerable#sum for older rubies

This commit is contained in:
HoneyryderChuck 2021-01-11 10:37:06 +00:00
parent 7fa283097d
commit 1691f50af5

View File

@ -15,8 +15,14 @@ module HTTPX::Plugins
"multipart/form-data; boundary=#{@boundary}"
end
def bytesize
@parts.map(&:size).sum
if RUBY_VERSION > "2.3"
def bytesize
@parts.map(&:size).sum
end
else
def bytesize
@parts.map(&:size).reduce(0, :+)
end
end
def read(length = nil, outbuf = nil)