lib/rack/multipart/generator.rb in rack-2.0.9.4 vs lib/rack/multipart/generator.rb in rack-2.1.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Rack module Multipart class Generator def initialize(params, first = true) @params, @first = params, first @@ -25,24 +27,21 @@ end.join << "--#{MULTIPART_BOUNDARY}--\r" end private def multipart? - multipart = false - query = lambda { |value| case value when Array - value.each(&query) + value.any?(&query) when Hash - value.values.each(&query) + value.values.any?(&query) when Rack::Multipart::UploadedFile - multipart = true + true end } - @params.values.each(&query) - multipart + @params.values.any?(&query) end def flattened_params @flattened_params ||= begin h = Hash.new