Method: Iri#del

Defined in:
lib/iri.rb

#del(*keys) ⇒ Iri Also known as: without

Deletes query parameters from the URI.

This method removes all instances of the specified parameters from the query string.

Examples:

Deleting a query parameter

Iri.new('https://google.com?q=test&limit=10').del(:q)
# => "https://google.com?limit=10"

Deleting multiple parameters

Iri.new('https://google.com?q=test&limit=10&sort=asc').del(:q, :limit)
# => "https://google.com?sort=asc"

Parameters:

  • keys (Array<Symbol, String>)

    List of parameter names to delete

Returns:

  • (Iri)

    A new Iri instance

See Also:



169
170
171
172
173
174
175
# File 'lib/iri.rb', line 169

def del(*keys)
  modify_query do |params|
    keys.each do |k|
      params.delete(k.to_s)
    end
  end
end