Class: HttpRouter::Node::SpanningRegex

### Home Classes Methods

### In Files

- lib/http_router/node/spanning_regex.rb

### Parent

HttpRouter::Node::Regex

### Methods

- #to_code

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

### Public Instance Methods

to_code() click to toggle source

    # File lib/http_router/node/spanning_regex.rb, line 4
    def to_code
      params_count = @ordered_indicies.size
      whole_path_var = "whole_path#{root.next_counter}"
      "#{whole_path_var} = request.joined_path
      if match = #{@matcher.inspect}.match(#{whole_path_var}) and match.begin(0).zero?
        _#{whole_path_var} = request.path.dup
        " << param_capturing_code << "
        remaining_path = #{whole_path_var}[match[0].size + (#{whole_path_var}[match[0].size] == ?/ ? 1 : 0), #{whole_path_var}.size]
        request.path = remaining_path.split('/')
        #{node_to_code}
        request.path = _#{whole_path_var}
        request.params.slice!(#{-params_count}, #{params_count})
      end
      "
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.