Module: Springboard::Client::URIExt
- Included in:
- Addressable::URI
- Defined in:
- lib/springboard/client/uri_ext.rb
Overview
Extensions to the Addressable::URI class.
Instance Method Summary collapse
-
#merge_query_values!(values) ⇒ Object
Merges the given hash of query string parameters and values with the URI’s existing query string parameters (if any).
-
#subpath(subpath) ⇒ Object
Returns a new URI with the given subpath appended to it.
Instance Method Details
#merge_query_values!(values) ⇒ Object
Merges the given hash of query string parameters and values with the URI’s existing query string parameters (if any).
18 19 20 |
# File 'lib/springboard/client/uri_ext.rb', line 18 def merge_query_values!(values) self.springboard_query_values = (self.query_values || {}).merge(normalize_query_hash(values)) end |
#subpath(subpath) ⇒ Object
Returns a new URI with the given subpath appended to it. Ensures a single forward slash between the URI’s path and the given subpath.
9 10 11 12 13 |
# File 'lib/springboard/client/uri_ext.rb', line 9 def subpath(subpath) uri = dup uri.path = "#{path}/" unless path.end_with?('/') uri.join subpath.to_s.gsub(/^\//, '') end |