lib/gscraper/extensions/uri/http.rb in gscraper-0.1.3 vs lib/gscraper/extensions/uri/http.rb in gscraper-0.1.4

- old
+ new

@@ -2,16 +2,18 @@ class HTTP # Query parameters attr_reader :query_params + alias_method :old_initialize, :initialize + # # Creates a new URI::HTTP object and initializes query_params as a # new Hash. # def initialize(*args) - super(*args) + old_initialize(*args) @query_params = {} parse_query_params end @@ -55,10 +57,14 @@ unless @query_params.empty? str += '?' + @query_params.to_a.map { |name,value| if value==true "#{name}=active" elsif value - "#{name}=#{URI.encode(value.to_s)}" + if value.kind_of?(Array) + "#{name}=#{URI.encode(value.join(' '))}" + else + "#{name}=#{URI.encode(value.to_s)}" + end else "#{name}=" end }.join('&') end