Module: QueryParamsMixin

Included in:
URI::Generic
Defined in:
lib/w-stdlib/core_ext/uri.rb

Instance Method Summary collapse

Instance Method Details

#query_paramsObject



4
5
6
# File 'lib/w-stdlib/core_ext/uri.rb', line 4

def query_params
  query.nil? ? {} : URI.decode_www_form(query).to_h
end

#with_query_params {|params| ... } ⇒ Object

Yields:

  • (params)


8
9
10
11
12
13
# File 'lib/w-stdlib/core_ext/uri.rb', line 8

def with_query_params
  params = query_params
  yield params
  self.query = URI.encode_www_form(params)
  self
end