From 0c458c0f40aede6c24a083d5d6bd5e7d0fb93d6c Mon Sep 17 00:00:00 2001 From: Ross Kaffenberger Date: Wed, 13 Nov 2024 18:37:41 -0500 Subject: [PATCH] addressable: Update overload signature of URI#query_values= (#722) Addressable::URI#query_values= additionally supports arguments given as an Array of Arrays, where the values of the inner Arrays may be Strings or Arrays of Strings. For more information: https://www.rubydoc.info/gems/addressable/Addressable/URI#query_values=-instance_method Co-authored-by: Ross Kaffenberger --- gems/addressable/2.8/_test/test.rb | 17 +++++++++++++++++ gems/addressable/2.8/addressable.rbs | 1 + 2 files changed, 18 insertions(+) diff --git a/gems/addressable/2.8/_test/test.rb b/gems/addressable/2.8/_test/test.rb index caaa7914..15112897 100644 --- a/gems/addressable/2.8/_test/test.rb +++ b/gems/addressable/2.8/_test/test.rb @@ -45,3 +45,20 @@ # "two" => "2", # "fragment" => "foo" # } + +uri = Addressable::URI.parse( + "http://example.com/a/b/c" +) +uri.query_values # => nil +uri.query_values = {"one" => "1", "two" => "2"} +uri.query_values # => {"one" => "1", "two" => "2"} +uri.query_values = ["three", "four"] +uri.query_values # => {"three" => nil, "four" => nil} +uri.query_values = [["five", "5"], ["six", "6"]] +uri.query_values # => {"five" => "5", "six" => "6"} +uri.query_values = [["seven"], ["andup", ["8", "9", "10"]]] +uri.query_values # => {"seven"=> nil, "andup"=>"10"} +uri.query_values = [["seven", "7"], ["andup", ["8", "9", "10"]]] +uri.query_values # => {"seven"=>"7", "andup"=>"10"} +uri.query_values = nil +uri.query_values # => nil diff --git a/gems/addressable/2.8/addressable.rbs b/gems/addressable/2.8/addressable.rbs index 8076af0a..8c6aaa9d 100644 --- a/gems/addressable/2.8/addressable.rbs +++ b/gems/addressable/2.8/addressable.rbs @@ -49,6 +49,7 @@ module Addressable | (singleton(Array) return_type) -> Array[String] def query_values=: (Hash[String, String]? new_query_values) -> Hash[String, String]? | (Array[String] new_query_values) -> Array[String] + | (Array[[String | Array[String]]] new_query_values) -> Array[[String | Array[String]]] def request_uri: () -> String def request_uri=: (String new_request_uri) -> String def fragment: () -> String?