Class: Rosendo::Routes::Route::Path::URL
- Inherits:
-
Object
- Object
- Rosendo::Routes::Route::Path::URL
- Defined in:
- lib/rosendo/routes.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url) ⇒ URL
constructor
A new instance of URL.
- #query_params ⇒ Object
Constructor Details
#initialize(url) ⇒ URL
Returns a new instance of URL.
68 69 70 71 |
# File 'lib/rosendo/routes.rb', line 68 def initialize(url) @url = url @path, @query = url.split('?') end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
67 68 69 |
# File 'lib/rosendo/routes.rb', line 67 def path @path end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
67 68 69 |
# File 'lib/rosendo/routes.rb', line 67 def query @query end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
67 68 69 |
# File 'lib/rosendo/routes.rb', line 67 def url @url end |
Instance Method Details
#query_params ⇒ Object
73 74 75 76 77 78 79 80 81 |
# File 'lib/rosendo/routes.rb', line 73 def query_params return {} unless query {}.tap do |params| query.split('&').each do |pair| k, v = pair.split('=') params[k.to_sym] = v end end end |