Skip to content

Commit 14c6985

Browse files
author
Matt Kelly
committed
Kill redudant coercion method
1 parent 2631b36 commit 14c6985

2 files changed

Lines changed: 3 additions & 22 deletions

File tree

lib/http/form_data/multipart.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def tail
5454
end
5555

5656
def parts(data)
57-
return Param.coerce_array_of_pairs data if data.is_a?(Array)
57+
return Param.coerce data if data.is_a?(Array)
5858
Param.coerce FormData.ensure_hash data
5959
end
6060
end

lib/http/form_data/multipart/param.rb

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ def initialize(name, value)
4040
@io = CompositeIO.new [header, @part, footer]
4141
end
4242

43-
# Flattens given `data` Hash into an array of `Param`'s.
43+
# Flattens given `data` Hash or Array into an array of `Param`'s.
4444
# Nested array are unwinded.
4545
# Behavior is similar to `URL.encode_www_form`.
4646
#
47-
# @param [Hash] data
47+
# @param [Array || Hash] data
4848
# @return [Array<FormData::MultiPart::Param>]
4949
def self.coerce(data)
5050
params = []
@@ -57,25 +57,6 @@ def self.coerce(data)
5757
params
5858
end
5959

60-
# Flattens given Array of `data` Array pairs into an array of `Param`'s.
61-
# Nested array are unwinded.
62-
# Behavior is similar to `URL.encode_www_form`.
63-
#
64-
# @param [Array] data
65-
# @return [Array<FormData::MultiPart::Param>]
66-
def self.coerce_array_of_pairs(data)
67-
params = []
68-
69-
data.each do |pair|
70-
name, values = pair
71-
Array(values).each do |value|
72-
params << new(name, value)
73-
end
74-
end
75-
76-
params
77-
end
78-
7960
private
8061

8162
def header

0 commit comments

Comments
 (0)