http_router 0.8.4 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -179,6 +179,16 @@ class HttpRouter
179
179
  @redirect_trailing_slash
180
180
  end
181
181
 
182
+ def rewrite_partial_path_info(env, request)
183
+ env['PATH_INFO'] = "/#{request.path.join('/')}"
184
+ env['SCRIPT_NAME'] += request.rack_request.path_info[0, request.rack_request.path_info.size - env['PATH_INFO'].size]
185
+ end
186
+
187
+ def rewrite_path_info(env, request)
188
+ env['SCRIPT_NAME'] += request.rack_request.path_info
189
+ env['PATH_INFO'] = ''
190
+ end
191
+
182
192
  # Creates a deep-copy of the router.
183
193
  def clone(klass = self.class)
184
194
  cloned_router = klass.new(@options)
@@ -24,12 +24,7 @@ class HttpRouter
24
24
  env['router.request'] = request
25
25
  env['router.params'] ||= {}
26
26
  #{"env['router.params'].merge!(Hash[#{path.param_names.inspect}.zip(request.params)])" if path.dynamic?}
27
- #{@allow_partial ? "
28
- env['PATH_INFO'] = \"/\#{request.path.join('/')}\"
29
- env['SCRIPT_NAME'] += request.rack_request.path_info[0, request.rack_request.path_info.size - env['PATH_INFO'].size]" :
30
- "env['PATH_INFO'] = ''
31
- env['SCRIPT_NAME'] += request.rack_request.path_info"
32
- }
27
+ #{@allow_partial ? "router.rewrite_partial_path_info(env, request)" : "router.rewrite_path_info(env, request)" }
33
28
  response = @router.process_destination_path(#{path_ivar}, env)
34
29
  router.pass_on_response(response) ? throw(:pass) : throw(:success, response)
35
30
  else
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  class HttpRouter #:nodoc
3
- VERSION = '0.8.4'
3
+ VERSION = '0.8.5'
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_router
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 4
10
- version: 0.8.4
9
+ - 5
10
+ version: 0.8.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Hull