Files

HttpRouter::Node::AbstractRequestNode

Attributes

request_method[R]
tests[R]

Public Class Methods

new(route, parent, tests, request_method) click to toggle source
# File lib/http_router/node/abstract_request_node.rb, line 6
def initialize(route, parent, tests, request_method)
  @request_method = request_method
  @tests = case tests
  when Array then tests
  when Set   then tests.to_a
  else            [tests]
  end
  super(route, parent)
end

Public Instance Methods

inspect_label() click to toggle source
# File lib/http_router/node/abstract_request_node.rb, line 26
def inspect_label
  "#{self.class.name.split("::").last} #{tests.inspect} (#{@matchers.size} matchers)"
end
to_code() click to toggle source
# File lib/http_router/node/abstract_request_node.rb, line 20
def to_code
  "if #{@tests.map { |test| "#{test.inspect} === request.rack_request.#{request_method}" } * ' or '}
    #{super}
  end"
end
usable?(other) click to toggle source
# File lib/http_router/node/abstract_request_node.rb, line 16
def usable?(other)
  other.class == self.class && other.tests == tests && other.request_method == request_method
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.