Skip to content

Commit 246a2ca

Browse files
author
Matt Kelly
committed
Use each slice vice cons
1 parent c38b2d0 commit 246a2ca

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

lib/http/form_data/multipart/param.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
require "http/form_data/readable"
44
require "http/form_data/composite_io"
5+
require "pry"
56

67
module HTTP
78
module FormData
@@ -51,6 +52,7 @@ def self.coerce(data)
5152
params = []
5253

5354
data.each do |name, values|
55+
binding.pry
5456
Array(values).each do |value|
5557
params << new(name, value)
5658
end
@@ -68,10 +70,11 @@ def self.coerce(data)
6870
def self.coerce_array_of_pairs(data)
6971
params = []
7072

71-
data.each_cons(2) do |name, values|
72-
Array(values).each do |value|
73-
params << new(name, value)
74-
end
73+
data.each_slice(2) do |first, second|
74+
binding.pry
75+
params << new(first[0], first[1])
76+
params << new(second[0], second[1])
77+
binding.pry
7578
end
7679

7780
params

0 commit comments

Comments
 (0)