Class: HttpRouter::Node::AbstractRequestNode

### Home Classes Methods

### In Files

- lib/http_router/node/abstract_request_node.rb

### Parent

HttpRouter::Node

### Methods

- ::new
- #inspect_label
- #to_code
- #usable?

### Files

- LICENSE

### Class/Module Index

Quicksearch

- HttpRouter
- HttpRouter::GenerationHelper
- HttpRouter::Generator
- HttpRouter::Generator::PathGenerator
- HttpRouter::Node
- HttpRouter::Node::AbstractRequestNode
- HttpRouter::Node::FreeRegex
- HttpRouter::Node::Glob
- HttpRouter::Node::GlobRegex
- HttpRouter::Node::Host
- HttpRouter::Node::Lookup
- HttpRouter::Node::Path
- HttpRouter::Node::Regex
- HttpRouter::Node::RequestMethod
- HttpRouter::Node::Root
- HttpRouter::Node::Scheme
- HttpRouter::Node::SpanningRegex
- HttpRouter::Node::UserAgent
- HttpRouter::Node::Variable
- HttpRouter::RegexRouteGeneration
- HttpRouter::Request
- HttpRouter::Response
- HttpRouter::Route
- HttpRouter::RouteHelper
- HttpRouter::Util

No matching classes.

# 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.