Class: URI::Generic
Instance Method Summary collapse
-
#params ⇒ Object
Return a Hash of the variables in the query string.
-
#params=(new_params) ⇒ Object
Update all the params at once.
-
#query ⇒ Object
Get the query string.
-
#query=(new_query) ⇒ Object
Set the query string.
-
#to_str ⇒ Object
URIs are strings, dammit!.
Instance Method Details
#params ⇒ Object
Return a Hash of the variables in the query string
23 24 25 |
# File 'lib/epitools/core_ext/uri.rb', line 23 def params @params ||= (@query ? @query.to_params : {}) end |
#params=(new_params) ⇒ Object
Update all the params at once
30 31 32 33 34 |
# File 'lib/epitools/core_ext/uri.rb', line 30 def params=(new_params) # self.query = new_params.to_params raise "params must be a Hash" unless new_params.is_a? Hash @params = new_params end |
#query ⇒ Object
Get the query string
8 9 10 |
# File 'lib/epitools/core_ext/uri.rb', line 8 def query params.to_query end |
#query=(new_query) ⇒ Object
Set the query string
15 16 17 18 |
# File 'lib/epitools/core_ext/uri.rb', line 15 def query=(new_query) @params = new_query&.to_params @query = new_query end |
#to_str ⇒ Object
URIs are strings, dammit!
48 49 50 |
# File 'lib/epitools/core_ext/uri.rb', line 48 def to_str to_s end |