Class: HttpRouter::Node::GlobRegex

### Home Classes Methods

### In Files

- lib/http_router/node/glob_regex.rb

### Parent

HttpRouter::Node::Glob

### Methods

- ::new
- #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::GlobRegex

### Attributes

matcher[R]

### Public Class Methods

new(router, parent, matcher) click to toggle source

    # File lib/http_router/node/glob_regex.rb, line 5
    def initialize(router, parent, matcher)
      @matcher = matcher
      super router, parent
    end

### Public Instance Methods

to_code() click to toggle source

    # File lib/http_router/node/glob_regex.rb, line 14
    def to_code
      id = root.next_counter
      "request.params << (globbed_params#{id} = [])
        remaining_parts = request.path.dup
        while !remaining_parts.empty? and match = remaining_parts.first.match(#{@matcher.inspect}) and match[0] == remaining_parts.first
          globbed_params#{id} << remaining_parts.shift
          request.path = remaining_parts
          #{node_to_code}
        end
        request.path[0,0] = request.params.pop"
    end

usable?(other) click to toggle source

    # File lib/http_router/node/glob_regex.rb, line 10
    def usable?(other)
      other.class == self.class && other.matcher == matcher
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.