Class: HttpRouter::Node::Root

### Home Classes Methods

### In Files

- lib/http_router/node/root.rb

### Parent

HttpRouter::Node

### Methods

- ::new
- #compile
- #depth
- #inject_root_ivar
- #inspect_label
- #next_counter
- #uncompile

### 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::Root

### Attributes

compiled[R]
compiled?[R]
methods_module[R]

### Public Class Methods

new(router) click to toggle source

    # File lib/http_router/node/root.rb, line 6
    def initialize(router)
      super(router, nil)
      @counter, @methods_module = 0, Module.new
    end

### Public Instance Methods

compile(routes) click to toggle source

    # File lib/http_router/node/root.rb, line 33
    def compile(routes)
      routes.each {|route| add_route(route)}
      root.extend(root.methods_module)
      instance_eval "def call(request, &callback)\n#{to_code}\nnil\nend"
      @compiled = true
    end

depth() click to toggle source

    # File lib/http_router/node/root.rb, line 25
    def depth
      0
    end

inject_root_ivar(obj) click to toggle source

    # File lib/http_router/node/root.rb, line 19
    def inject_root_ivar(obj)
      name = :"@ivar_#{@counter += 1}"
      root.instance_variable_set(name, obj)
      name
    end

inspect_label() click to toggle source

    # File lib/http_router/node/root.rb, line 29
    def inspect_label
      "Root (#{@matchers.size} matchers)"
    end

next_counter() click to toggle source

    # File lib/http_router/node/root.rb, line 15
    def next_counter
      @counter += 1
    end

uncompile() click to toggle source

    # File lib/http_router/node/root.rb, line 11
    def uncompile
      instance_eval "undef :call; def call(req); raise 'uncompiled root'; end", __FILE__, __LINE__ if compiled?
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.