rack-mount 0.6.10 → 0.6.11
Sign up to get free protection for your applications and to get access to all the features.
@@ -25,6 +25,8 @@ module Rack::Mount
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def optimize_container_iterator(container)
|
28
|
+
Utils.debug "optimizing container - size #{container.size}"
|
29
|
+
|
28
30
|
body = []
|
29
31
|
|
30
32
|
container.each_with_index { |route, i|
|
@@ -67,6 +69,8 @@ module Rack::Mount
|
|
67
69
|
end
|
68
70
|
|
69
71
|
def optimize_recognize!
|
72
|
+
Utils.debug "optimizing recognize"
|
73
|
+
|
70
74
|
keys = @recognition_keys.map { |key|
|
71
75
|
if key.respond_to?(:call_source)
|
72
76
|
key.call_source(:cache, :obj)
|
@@ -105,7 +109,7 @@ module Rack::Mount
|
|
105
109
|
# has not been defined in the metaclass yet.
|
106
110
|
def remove_metaclass_method(symbol)
|
107
111
|
metaclass = class << self; self; end
|
108
|
-
metaclass.send(:remove_method, symbol)
|
112
|
+
Utils.silence_debug { metaclass.send(:remove_method, symbol) }
|
109
113
|
rescue NameError => e
|
110
114
|
nil
|
111
115
|
end
|
data/lib/rack/mount/route_set.rb
CHANGED
@@ -245,10 +245,14 @@ module Rack::Mount
|
|
245
245
|
end
|
246
246
|
|
247
247
|
def rehash #:nodoc:
|
248
|
+
Utils.debug "rehashing"
|
249
|
+
|
248
250
|
@recognition_keys = build_recognition_keys
|
249
251
|
@recognition_graph = build_recognition_graph
|
250
252
|
@generation_keys = build_generation_keys
|
251
253
|
@generation_graph = build_generation_graph
|
254
|
+
|
255
|
+
self
|
252
256
|
end
|
253
257
|
|
254
258
|
# Finalizes the set and builds optimized data structures. You *must*
|
@@ -323,7 +327,7 @@ module Rack::Mount
|
|
323
327
|
catch(:skip) do
|
324
328
|
k = keys.map { |key| block.call(key, index) }
|
325
329
|
Utils.pop_trailing_nils!(k)
|
326
|
-
k.map! { |key| key ||
|
330
|
+
k.map! { |key| key || /.*/ }
|
327
331
|
graph[*k] = route
|
328
332
|
end
|
329
333
|
end
|
@@ -337,7 +341,9 @@ module Rack::Mount
|
|
337
341
|
end
|
338
342
|
|
339
343
|
def build_recognition_keys
|
340
|
-
@recognition_key_analyzer.report
|
344
|
+
keys = @recognition_key_analyzer.report
|
345
|
+
Utils.debug "recognition keys - #{keys.inspect}"
|
346
|
+
keys
|
341
347
|
end
|
342
348
|
|
343
349
|
def build_generation_graph
|
@@ -353,7 +359,9 @@ module Rack::Mount
|
|
353
359
|
end
|
354
360
|
|
355
361
|
def build_generation_keys
|
356
|
-
@generation_key_analyzer.report
|
362
|
+
keys = @generation_key_analyzer.report
|
363
|
+
Utils.debug "generation keys - #{keys.inspect}"
|
364
|
+
keys
|
357
365
|
end
|
358
366
|
|
359
367
|
def extract_params!(*args)
|
data/lib/rack/mount/utils.rb
CHANGED
@@ -14,6 +14,19 @@ module Rack::Mount
|
|
14
14
|
# more appropriate contexts.
|
15
15
|
#++
|
16
16
|
module Utils
|
17
|
+
def silence_debug
|
18
|
+
old_debug, $DEBUG = $DEBUG, nil
|
19
|
+
yield
|
20
|
+
ensure
|
21
|
+
$DEBUG = old_debug
|
22
|
+
end
|
23
|
+
module_function :silence_debug
|
24
|
+
|
25
|
+
def debug(msg)
|
26
|
+
warn "Rack::Mount #{msg}" if $DEBUG
|
27
|
+
end
|
28
|
+
module_function :debug
|
29
|
+
|
17
30
|
# Normalizes URI path.
|
18
31
|
#
|
19
32
|
# Strips off trailing slash and ensures there is a leading slash.
|
data/lib/rack/mount/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-mount
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 11
|
10
|
+
version: 0.6.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joshua Peek
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-20 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|