Class: Hobby::Router::Route
- Inherits:
-
Object
- Object
- Hobby::Router::Route
- Defined in:
- lib/hobby/router/route.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
(also: #to_proc)
Returns the value of attribute action.
-
#params ⇒ Object
Returns the value of attribute params.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#verb ⇒ Object
readonly
Returns the value of attribute verb.
Instance Method Summary collapse
-
#initialize(verb, path, &action) ⇒ Route
constructor
A new instance of Route.
- #with_params(params) ⇒ Object
Constructor Details
#initialize(verb, path, &action) ⇒ Route
Returns a new instance of Route.
3 4 5 6 |
# File 'lib/hobby/router/route.rb', line 3 def initialize verb, path, &action @verb, @path, @action = verb, path, action @params = {} end |
Instance Attribute Details
#action ⇒ Object Also known as: to_proc
Returns the value of attribute action.
9 10 11 |
# File 'lib/hobby/router/route.rb', line 9 def action @action end |
#params ⇒ Object
Returns the value of attribute params.
9 10 11 |
# File 'lib/hobby/router/route.rb', line 9 def params @params end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/hobby/router/route.rb', line 8 def path @path end |
#verb ⇒ Object (readonly)
Returns the value of attribute verb.
8 9 10 |
# File 'lib/hobby/router/route.rb', line 8 def verb @verb end |
Instance Method Details
#with_params(params) ⇒ Object
11 12 13 14 15 |
# File 'lib/hobby/router/route.rb', line 11 def with_params params new_route = dup new_route.params = params new_route end |