Class: Expressr::RouteNode
- Inherits:
-
Object
- Object
- Expressr::RouteNode
- Defined in:
- lib/expressr/route_node.rb
Instance Method Summary collapse
- #call(request, response) ⇒ Object
- #continue ⇒ Object
-
#initialize(proc, next_node, options = {}) ⇒ RouteNode
constructor
A new instance of RouteNode.
Constructor Details
#initialize(proc, next_node, options = {}) ⇒ RouteNode
Returns a new instance of RouteNode.
3 4 5 6 7 8 |
# File 'lib/expressr/route_node.rb', line 3 def initialize(proc, next_node, ={}) @proc = proc @next_node = next_node @additional_arguments = [:additional_arguments] || [] @has_continued = false end |
Instance Method Details
#call(request, response) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/expressr/route_node.rb', line 10 def call(request, response) @request = request @response = response instance_exec(request, response, &@proc) continue unless @has_continued end |
#continue ⇒ Object
17 18 19 20 |
# File 'lib/expressr/route_node.rb', line 17 def continue @has_continued = true @next_node.call(@request, @response, *@additional_arguments) end |