Class: HttpRouter::ArbitraryNode

Inherits:
Node
  • Object
show all
Defined in:
lib/http_router/node.rb

Instance Attribute Summary

Attributes inherited from Node

#arbitrary_node, #catchall, #linear, #lookup, #request_node, #value, #variable

Instance Method Summary collapse

Methods inherited from Node

#add, #add_arbitrary, #add_request_methods, #add_to_linear, #initialize, #reset!

Constructor Details

This class inherits a constructor from HttpRouter::Node

Instance Method Details

#find_on_arbitrary(request) ⇒ Object



191
192
193
194
195
196
197
198
199
# File 'lib/http_router/node.rb', line 191

def find_on_arbitrary(request)
  if @linear && !@linear.empty?
    next_node = @linear.find do |(procs, node)|
      procs.all?{|p| p.call(request)}
    end
    return next_node.last if next_node
  end
  @catchall
end