Files

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.