Class: Truss::Router::Node
- Inherits:
-
Object
- Object
- Truss::Router::Node
- Defined in:
- lib/truss/router/node.rb
Direct Known Subclasses
Routes::Delete, Routes::Get, Routes::Head, Routes::Options, Routes::Patch, Routes::Post, Routes::Put
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#matchable_regex ⇒ Object
Returns the value of attribute matchable_regex.
-
#options ⇒ Object
Returns the value of attribute options.
-
#path ⇒ Object
Returns the value of attribute path.
-
#request_method ⇒ Object
Returns the value of attribute request_method.
Instance Method Summary collapse
- #call(request) ⇒ Object
-
#initialize(method, path, endpoint, options = {}) ⇒ Node
constructor
A new instance of Node.
- #matches?(request) ⇒ Boolean
Constructor Details
#initialize(method, path, endpoint, options = {}) ⇒ Node
Returns a new instance of Node.
5 6 7 8 9 |
# File 'lib/truss/router/node.rb', line 5 def initialize(method, path, endpoint, ={}) @request_method, @path, @endpoint = method, path, endpoint @matchable_regex = build_matchable_regex(method, path, ) @options = end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
4 5 6 |
# File 'lib/truss/router/node.rb', line 4 def endpoint @endpoint end |
#matchable_regex ⇒ Object
Returns the value of attribute matchable_regex.
4 5 6 |
# File 'lib/truss/router/node.rb', line 4 def matchable_regex @matchable_regex end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/truss/router/node.rb', line 4 def @options end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/truss/router/node.rb', line 4 def path @path end |
#request_method ⇒ Object
Returns the value of attribute request_method.
4 5 6 |
# File 'lib/truss/router/node.rb', line 4 def request_method @request_method end |
Instance Method Details
#call(request) ⇒ Object
15 16 17 |
# File 'lib/truss/router/node.rb', line 15 def call request endpoint.call(request) end |
#matches?(request) ⇒ Boolean
11 12 13 |
# File 'lib/truss/router/node.rb', line 11 def matches? request matchable_regex.match(request.routing_path) end |