Class: HttpRouter::Node::Lookup

### Home Classes Methods

### In Files

- lib/http_router/node/lookup.rb

### Parent

HttpRouter::Node

### Methods

- ::new
- #add
- #inspect_label
- #inspect_matchers_body
- #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::Lookup

### Public Class Methods

new(router, parent) click to toggle source

    # File lib/http_router/node/lookup.rb, line 4
    def initialize(router, parent)
      @map = {}
      super(router, parent)
    end

### Public Instance Methods

add(part) click to toggle source

    # File lib/http_router/node/lookup.rb, line 9
    def add(part)
      Node.new(@router, self, @map[part] ||= [])
    end

inspect_label() click to toggle source

    # File lib/http_router/node/lookup.rb, line 23
    def inspect_label
      "#{self.class.name}"
    end

inspect_matchers_body() click to toggle source

    # File lib/http_router/node/lookup.rb, line 17
    def inspect_matchers_body
      @map.map { |key, values|
        ins = "#{' ' * depth}when #{key.inspect}:\n"
        ins << values.map{|v| v.inspect}.join("\n") }.join("\n")
    end

to_code() click to toggle source

    # File lib/http_router/node/lookup.rb, line 27
    def to_code
      part_name = "part#{root.next_counter}"
      "unless request.path_finished?
        #{part_name} = request.path.shift
        case #{part_name}
          #{@map.map{|k, v| "when #{k.inspect}; #{v.map(&:to_code) * "\n"};"} * "\n"}
        end
        request.path.unshift #{part_name}
      end"
    end

usable?(other) click to toggle source

    # File lib/http_router/node/lookup.rb, line 13
    def usable?(other)
      other.class == self.class
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.