Class: Rosendo::Routes::Route
- Inherits:
-
Object
- Object
- Rosendo::Routes::Route
- Defined in:
- lib/rosendo/routes.rb
Defined Under Namespace
Classes: Path
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #call(request, response) ⇒ Object
-
#initialize(method, path, &block) ⇒ Route
constructor
A new instance of Route.
- #matches?(request) ⇒ Boolean
Constructor Details
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
20 21 22 |
# File 'lib/rosendo/routes.rb', line 20 def method @method end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
20 21 22 |
# File 'lib/rosendo/routes.rb', line 20 def path @path end |
Instance Method Details
#call(request, response) ⇒ Object
32 33 34 |
# File 'lib/rosendo/routes.rb', line 32 def call(request, response) DSL.new(request, response, path.params(request.url)).instance_eval(&@block) end |
#matches?(request) ⇒ Boolean
27 28 29 30 |
# File 'lib/rosendo/routes.rb', line 27 def matches?(request) method == request.method && path.matches?(request.url) end |