File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments