Method: Iri#over
- Defined in:
- lib/iri.rb
#over(hash) ⇒ Iri
Replaces query parameters in the URI.
Unlike #add, this method replaces any existing parameters with the same name rather than adding additional instances. If a parameter doesn’t exist, it will be added.
197 198 199 200 201 202 203 204 205 206 |
# File 'lib/iri.rb', line 197 def over(hash) raise ArgumentError, "The hash can't be nil" if hash.nil? raise InvalidArguments unless hash.is_a?(Hash) modify_query do |params| hash.each do |k, v| params[k.to_s] = [] unless params[k.to_s] params[k.to_s] = [v] end end end |