File tree Expand file tree Collapse file tree 2 files changed +3
-23
lines changed
Expand file tree Collapse file tree 2 files changed +3
-23
lines changed 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 22
33require "http/form_data/readable"
44require "http/form_data/composite_io"
5- require "pry"
65
76module HTTP
87 module FormData
@@ -40,11 +39,11 @@ def initialize(name, value)
4039 @io = CompositeIO . new [ header , @part , footer ]
4140 end
4241
43- # Flattens given `data` Hash into an array of `Param`'s.
42+ # Flattens given `data` Hash or Array into an array of `Param`'s.
4443 # Nested array are unwinded.
4544 # Behavior is similar to `URL.encode_www_form`.
4645 #
47- # @param [Hash] data
46+ # @param [Array || Hash] data
4847 # @return [Array<FormData::MultiPart::Param>]
4948 def self . coerce ( data )
5049 params = [ ]
@@ -57,25 +56,6 @@ def self.coerce(data)
5756 params
5857 end
5958
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-
7959 private
8060
8161 def header
You can’t perform that action at this time.
0 commit comments