Class: Racket::Router::Route
- Inherits:
-
Struct
- Object
- Struct
- Racket::Router::Route
- Defined in:
- lib/racket/router.rb
Overview
A struct describing a route.
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#params ⇒ Object
Returns the value of attribute params.
-
#root ⇒ Object
Returns the value of attribute root.
Instance Method Summary collapse
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action
28 29 30 |
# File 'lib/racket/router.rb', line 28 def action @action end |
#params ⇒ Object
Returns the value of attribute params
28 29 30 |
# File 'lib/racket/router.rb', line 28 def params @params end |
#root ⇒ Object
Returns the value of attribute root
28 29 30 |
# File 'lib/racket/router.rb', line 28 def root @root end |
Instance Method Details
#to_s ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/racket/router.rb', line 29 def to_s route = root.dup route << "/#{action}" if action route << "/#{params.join('/')}" unless params.empty? route = route[1..-1] if route.start_with?('//') # Special case for root path route end |