Skip to content

Commit

Permalink
Use each slice vice cons
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Kelly committed May 27, 2021
1 parent c38b2d0 commit 246a2ca
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/http/form_data/multipart/param.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require "http/form_data/readable"
require "http/form_data/composite_io"
require "pry"

module HTTP
module FormData
Expand Down Expand Up @@ -51,6 +52,7 @@ def self.coerce(data)
params = []

data.each do |name, values|
binding.pry
Array(values).each do |value|
params << new(name, value)
end
Expand All @@ -68,10 +70,11 @@ def self.coerce(data)
def self.coerce_array_of_pairs(data)
params = []

data.each_cons(2) do |name, values|
Array(values).each do |value|
params << new(name, value)
end
data.each_slice(2) do |first, second|
binding.pry
params << new(first[0], first[1])
params << new(second[0], second[1])
binding.pry
end

params
Expand Down

0 comments on commit 246a2ca

Please sign in to comment.