Permalink
Browse files

fixes for 1.9

  • Loading branch information...
1 parent ffe7936 commit 609573f490b9cf0a1e3e472100694fc7ccc90aa6 @joshbuddy committed Sep 29, 2011
Showing with 5 additions and 4 deletions.
  1. +2 −1 lib/http_router/generator.rb
  2. +1 −1 lib/http_router/node/lookup.rb
  3. +2 −2 lib/http_router/node/root.rb
@@ -3,7 +3,8 @@ class Generator
SCHEME_PORTS = {'http' => 80, 'https' => 443}
class PathGenerator
- attr_reader :path, :param_names
+ attr_reader :path
+ attr_accessor :param_names
def initialize(route, path, validation_regex = nil)
@route = route
@path = path.dup
@@ -29,7 +29,7 @@ def to_code
"unless request.path_finished?
#{part_name} = request.path.shift
case #{part_name}
- #{@map.map{|k, v| "when #{k.inspect}; #{v.map(&:to_code) * "\n"};"}}
+ #{@map.map{|k, v| "when #{k.inspect}; #{v.map(&:to_code) * "\n"};"} * "\n"}
end
request.path.unshift #{part_name}
end"
@@ -33,7 +33,7 @@ def inspect_label
def compile(routes)
routes.each {|route| add_route(route)}
root.extend(root.methods_module)
- instance_eval "def call(request, &callback)\ncalled = false\n#{to_code}\ncallback ? called : nil\nend", __FILE__, __LINE__
+ instance_eval "def call(request, &callback)\ncalled = false\n#{to_code}\ncallback ? called : nil\nend"
@compiled = true
end
@@ -49,7 +49,7 @@ def add_route(route)
start_index, end_index = 0, 1
raw_paths, chars = [""], path_for_generation.split('')
until chars.empty?
- case fc = chars.first[0]
+ case chars.first[0]
when ?(
chars.shift
(start_index...end_index).each { |path_index| raw_paths << raw_paths[path_index].dup }

0 comments on commit 609573f

Please sign in to comment.