Method: Wgit::Url#omit_query

Defined in:
lib/wgit/url.rb

#omit_queryWgit::Url

Returns a new Wgit::Url with the query string portion removed e.g. Given http://google.com/search?q=hello, http://google.com/search is returned. Self is returned as is if no query string is present. A URL consisting of only a query string e.g. '?q=hello' will return an empty URL.

Returns:

  • (Wgit::Url)

    Self with the query string portion removed.



653
654
655
656
657
658
# File 'lib/wgit/url.rb', line 653

def omit_query
  query = to_query
  omit_query_string = query ? gsub("?#{query}", "") : self

  Wgit::Url.new(omit_query_string)
end