rack-mount 0.0.1 → 0.8.3

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.
Files changed (43) hide show
  1. data/README.rdoc +12 -4
  2. data/lib/rack/mount/analysis/histogram.rb +55 -6
  3. data/lib/rack/mount/analysis/splitting.rb +103 -89
  4. data/lib/rack/mount/code_generation.rb +120 -0
  5. data/lib/rack/mount/generatable_regexp.rb +95 -48
  6. data/lib/rack/mount/multimap.rb +84 -41
  7. data/lib/rack/mount/prefix.rb +13 -8
  8. data/lib/rack/mount/regexp_with_named_groups.rb +27 -7
  9. data/lib/rack/mount/route.rb +75 -18
  10. data/lib/rack/mount/route_set.rb +308 -22
  11. data/lib/rack/mount/strexp/parser.rb +160 -0
  12. data/lib/rack/mount/strexp/tokenizer.rb +83 -0
  13. data/lib/rack/mount/strexp.rb +54 -79
  14. data/lib/rack/mount/utils.rb +65 -174
  15. data/lib/rack/mount/vendor/regin/regin/alternation.rb +40 -0
  16. data/lib/rack/mount/vendor/regin/regin/anchor.rb +4 -0
  17. data/lib/rack/mount/vendor/regin/regin/atom.rb +54 -0
  18. data/lib/rack/mount/vendor/regin/regin/character.rb +51 -0
  19. data/lib/rack/mount/vendor/regin/regin/character_class.rb +50 -0
  20. data/lib/rack/mount/vendor/regin/regin/collection.rb +77 -0
  21. data/lib/rack/mount/vendor/regin/regin/expression.rb +126 -0
  22. data/lib/rack/mount/vendor/regin/regin/group.rb +90 -0
  23. data/lib/rack/mount/vendor/regin/regin/options.rb +55 -0
  24. data/lib/rack/mount/vendor/regin/regin/parser.rb +546 -0
  25. data/lib/rack/mount/vendor/regin/regin/tokenizer.rb +255 -0
  26. data/lib/rack/mount/vendor/regin/regin/version.rb +3 -0
  27. data/lib/rack/mount/vendor/regin/regin.rb +75 -0
  28. data/lib/rack/mount/version.rb +3 -0
  29. data/lib/rack/mount.rb +13 -17
  30. metadata +88 -35
  31. data/lib/rack/mount/analysis/frequency.rb +0 -51
  32. data/lib/rack/mount/const.rb +0 -45
  33. data/lib/rack/mount/exceptions.rb +0 -3
  34. data/lib/rack/mount/generation/route.rb +0 -57
  35. data/lib/rack/mount/generation/route_set.rb +0 -163
  36. data/lib/rack/mount/meta_method.rb +0 -104
  37. data/lib/rack/mount/mixover.rb +0 -47
  38. data/lib/rack/mount/recognition/code_generation.rb +0 -99
  39. data/lib/rack/mount/recognition/route.rb +0 -59
  40. data/lib/rack/mount/recognition/route_set.rb +0 -88
  41. data/lib/rack/mount/vendor/multimap/multimap.rb +0 -466
  42. data/lib/rack/mount/vendor/multimap/multiset.rb +0 -153
  43. data/lib/rack/mount/vendor/multimap/nested_multimap.rb +0 -156
@@ -0,0 +1,255 @@
1
+ #--
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by rex 1.0.5
4
+ # from lexical definition file "lib/regin/tokenizer.rex".
5
+ #++
6
+
7
+ require 'racc/parser'
8
+ class Regin::Parser < Racc::Parser
9
+ require 'strscan'
10
+
11
+ class ScanError < StandardError ; end
12
+
13
+ attr_reader :lineno
14
+ attr_reader :filename
15
+ attr_accessor :state
16
+
17
+ def scan_setup(str)
18
+ @ss = StringScanner.new(str)
19
+ @lineno = 1
20
+ @state = nil
21
+ end
22
+
23
+ def action
24
+ yield
25
+ end
26
+
27
+ def scan_str(str)
28
+ scan_setup(str)
29
+ do_parse
30
+ end
31
+ alias :scan :scan_str
32
+
33
+ def load_file( filename )
34
+ @filename = filename
35
+ open(filename, "r") do |f|
36
+ scan_setup(f.read)
37
+ end
38
+ end
39
+
40
+ def scan_file( filename )
41
+ load_file(filename)
42
+ do_parse
43
+ end
44
+
45
+
46
+ def next_token
47
+ return if @ss.eos?
48
+
49
+ # skips empty actions
50
+ until token = _next_token or @ss.eos?; end
51
+ token
52
+ end
53
+
54
+ def _next_token
55
+ text = @ss.peek(1)
56
+ @lineno += 1 if text == "\n"
57
+ token = case @state
58
+ when nil
59
+ case
60
+ when (text = @ss.scan(/\\[dDsSwW]/))
61
+ action { [:CCLASS, text] }
62
+
63
+ when (text = @ss.scan(/\^|\\A/))
64
+ action { [:L_ANCHOR, text] }
65
+
66
+ when (text = @ss.scan(/\$|\\Z/))
67
+ action { [:R_ANCHOR, text] }
68
+
69
+ when (text = @ss.scan(/<(\w+)>/))
70
+ action { [:NAME, @ss[1]] }
71
+
72
+ when (text = @ss.scan(/\(/))
73
+ action {
74
+ @capture_index_stack << @capture_index
75
+ @capture_index += 1
76
+ @state = :OPTIONS if @ss.peek(1) == '?';
77
+ [:LPAREN, text]
78
+ }
79
+
80
+
81
+ when (text = @ss.scan(/\)/))
82
+ action { [:RPAREN, text] }
83
+
84
+ when (text = @ss.scan(/\[/))
85
+ action { @state = :CCLASS; [:LBRACK, text] }
86
+
87
+ when (text = @ss.scan(/\{/))
88
+ action { [:LCURLY, text] }
89
+
90
+ when (text = @ss.scan(/\}/))
91
+ action { [:RCURLY, text] }
92
+
93
+ when (text = @ss.scan(/\|/))
94
+ action { [:BAR, text] }
95
+
96
+ when (text = @ss.scan(/\./))
97
+ action { [:DOT, text] }
98
+
99
+ when (text = @ss.scan(/\!/))
100
+ action { [:BANG, text] }
101
+
102
+ when (text = @ss.scan(/\=/))
103
+ action { [:EQUAL, text] }
104
+
105
+ when (text = @ss.scan(/\?/))
106
+ action { [:QMARK, text] }
107
+
108
+ when (text = @ss.scan(/\+/))
109
+ action { [:PLUS, text] }
110
+
111
+ when (text = @ss.scan(/\*/))
112
+ action { [:STAR, text] }
113
+
114
+ when (text = @ss.scan(/\#/))
115
+ action {
116
+ if @options_stack[-1][:extended]
117
+ @state = :COMMENT;
118
+ next_token
119
+ else
120
+ [:CHAR, text]
121
+ end
122
+ }
123
+
124
+
125
+ when (text = @ss.scan(/\s|\n/))
126
+ action {
127
+ if @options_stack[-1][:extended]
128
+ next_token
129
+ else
130
+ [:CHAR, text]
131
+ end
132
+ }
133
+
134
+
135
+ when (text = @ss.scan(/\\(.)/))
136
+ action { [:CHAR, @ss[1]] }
137
+
138
+ when (text = @ss.scan(/./))
139
+ action { [:CHAR, text] }
140
+
141
+ else
142
+ text = @ss.string[@ss.pos .. -1]
143
+ raise ScanError, "can not match: '" + text + "'"
144
+ end # if
145
+
146
+ when :CCLASS
147
+ case
148
+ when (text = @ss.scan(/\[/))
149
+ action { [:LBRACK, text] }
150
+
151
+ when (text = @ss.scan(/\]/))
152
+ action { @state = nil; [:RBRACK, text] }
153
+
154
+ when (text = @ss.scan(/\^/))
155
+ action { [@ss.string[@ss.pos-2, 1] == '[' ? :NEGATE : :CHAR, text] }
156
+
157
+ when (text = @ss.scan(/:/))
158
+ action {
159
+ if @ss.string[@ss.pos-2, 1] == '['
160
+ @state = :POSIX_CCLASS
161
+ [:COLON, text]
162
+ else
163
+ [:CHAR, text]
164
+ end
165
+ }
166
+
167
+
168
+ when (text = @ss.scan(/\\-/))
169
+ action { [:CHAR, text] }
170
+
171
+ when (text = @ss.scan(/\\[dDsSwW]/))
172
+ action { [:CHAR, text] }
173
+
174
+ when (text = @ss.scan(/\\(.)/))
175
+ action { [:CHAR, @ss[1]] }
176
+
177
+ when (text = @ss.scan(/./))
178
+ action { [:CHAR, text] }
179
+
180
+ else
181
+ text = @ss.string[@ss.pos .. -1]
182
+ raise ScanError, "can not match: '" + text + "'"
183
+ end # if
184
+
185
+ when :POSIX_CCLASS
186
+ case
187
+ when (text = @ss.scan(/\w+/))
188
+ action { [text, text] }
189
+
190
+ when (text = @ss.scan(/:/))
191
+ action { [:COLON, text] }
192
+
193
+ when (text = @ss.scan(/\]/))
194
+ action { @state = :CCLASS; [:RBRACK, text] }
195
+
196
+ else
197
+ text = @ss.string[@ss.pos .. -1]
198
+ raise ScanError, "can not match: '" + text + "'"
199
+ end # if
200
+
201
+ when :OPTIONS
202
+ case
203
+ when (text = @ss.scan(/\?/))
204
+ action {
205
+ @state = nil unless @ss.peek(1) =~ /-|m|i|x|:/
206
+ [:QMARK, text]
207
+ }
208
+
209
+
210
+ when (text = @ss.scan(/\-/))
211
+ action { [:MINUS, text] }
212
+
213
+ when (text = @ss.scan(/m/))
214
+ action { [:MULTILINE, text] }
215
+
216
+ when (text = @ss.scan(/i/))
217
+ action { [:IGNORECASE, text] }
218
+
219
+ when (text = @ss.scan(/x/))
220
+ action { [:EXTENDED, text] }
221
+
222
+ when (text = @ss.scan(/\:/))
223
+ action {
224
+ @capture_index_stack.pop
225
+ @capture_index -= 1
226
+ @state = nil;
227
+ [:COLON, text]
228
+ }
229
+
230
+
231
+ else
232
+ text = @ss.string[@ss.pos .. -1]
233
+ raise ScanError, "can not match: '" + text + "'"
234
+ end # if
235
+
236
+ when :COMMENT
237
+ case
238
+ when (text = @ss.scan(/\n/))
239
+ action { @state = nil; next_token }
240
+
241
+ when (text = @ss.scan(/./))
242
+ action { next_token }
243
+
244
+ else
245
+ text = @ss.string[@ss.pos .. -1]
246
+ raise ScanError, "can not match: '" + text + "'"
247
+ end # if
248
+
249
+ else
250
+ raise ScanError, "undefined state: '" + state.to_s + "'"
251
+ end # case state
252
+ token
253
+ end # def _next_token
254
+
255
+ end # class
@@ -0,0 +1,3 @@
1
+ module Regin
2
+ Version = '0.3.7'
3
+ end
@@ -0,0 +1,75 @@
1
+ module Regin
2
+ autoload :Alternation, 'regin/alternation'
3
+ autoload :Anchor, 'regin/anchor'
4
+ autoload :Atom, 'regin/atom'
5
+ autoload :Character, 'regin/character'
6
+ autoload :CharacterClass, 'regin/character_class'
7
+ autoload :Collection, 'regin/collection'
8
+ autoload :Expression, 'regin/expression'
9
+ autoload :Group, 'regin/group'
10
+ autoload :Options, 'regin/options'
11
+ autoload :Parser, 'regin/parser'
12
+
13
+ # Detect named capture support
14
+ begin
15
+ old_debug, $DEBUG = $DEBUG, nil
16
+ eval('foo = /(?<foo>.*)/').named_captures
17
+
18
+ # Returns true if the interpreter is using the Oniguruma Regexp lib
19
+ # and supports named captures.
20
+ #
21
+ # /(?<foo>bar)/
22
+ def self.regexp_supports_named_captures?
23
+ true
24
+ end
25
+ rescue SyntaxError, NoMethodError
26
+ def self.regexp_supports_named_captures? #:nodoc:
27
+ false
28
+ end
29
+ ensure
30
+ $DEBUG = old_debug
31
+ end
32
+
33
+
34
+ POSIX_BRACKET_TYPES = %w(
35
+ alnum alpha ascii blank cntrl digit graph
36
+ lower print punct space upper word xdigit
37
+ foo
38
+ )
39
+
40
+ # Returns array of supported POSX bracket types
41
+ def self.supported_posix_bracket_types
42
+ @supported_posix_bracket_types ||= []
43
+ end
44
+
45
+ # Detect supported posix bracket types
46
+ begin
47
+ old_debug, $DEBUG = $DEBUG, nil
48
+
49
+ POSIX_BRACKET_TYPES.each do |type|
50
+ begin
51
+ eval("foo = /[[:#{type}:]]/")
52
+ supported_posix_bracket_types << type
53
+ rescue SyntaxError, RegexpError
54
+ end
55
+ end
56
+ ensure
57
+ $DEBUG = old_debug
58
+ end
59
+
60
+
61
+ # Parses Regexp and returns a Expression data structure.
62
+ def self.parse(regexp)
63
+ Parser.parse_regexp(regexp)
64
+ end
65
+
66
+ # Recompiles Regexp by parsing it and turning it back into a Regexp.
67
+ #
68
+ # (In the future Regin will perform some Regexp optimizations
69
+ # such as removing unnecessary captures and options)
70
+ def self.compile(source)
71
+ regexp = Regexp.compile(source)
72
+ expression = parse(regexp)
73
+ Regexp.compile(expression.to_s(true), expression.flags)
74
+ end
75
+ end
@@ -0,0 +1,3 @@
1
+ module Rack::Mount
2
+ Version = '0.8.3'
3
+ end
data/lib/rack/mount.rb CHANGED
@@ -1,35 +1,31 @@
1
1
  require 'rack'
2
2
 
3
3
  module Rack #:nodoc:
4
- module Mount #:nodoc:
5
- autoload :Const, 'rack/mount/const'
4
+ # A stackable dynamic tree based Rack router.
5
+ #
6
+ # Rack::Mount supports Rack's Cascade style of trying several routes until
7
+ # it finds one that is not a 404. This allows multiple routes to be nested
8
+ # or stacked on top of each other. Since the application endpoint can
9
+ # trigger the router to continue matching, middleware can be used to add
10
+ # arbitrary conditions to any route. This allows you to route based on
11
+ # other request attributes, session information, or even data dynamically
12
+ # pulled from a database.
13
+ module Mount
14
+ autoload :CodeGeneration, 'rack/mount/code_generation'
6
15
  autoload :GeneratableRegexp, 'rack/mount/generatable_regexp'
7
- autoload :MetaMethod, 'rack/mount/meta_method'
8
- autoload :Mixover, 'rack/mount/mixover'
9
16
  autoload :Multimap, 'rack/mount/multimap'
10
17
  autoload :Prefix, 'rack/mount/prefix'
11
18
  autoload :RegexpWithNamedGroups, 'rack/mount/regexp_with_named_groups'
12
19
  autoload :Route, 'rack/mount/route'
13
20
  autoload :RouteSet, 'rack/mount/route_set'
14
- autoload :RoutingError, 'rack/mount/exceptions'
21
+ autoload :RoutingError, 'rack/mount/route_set'
15
22
  autoload :Strexp, 'rack/mount/strexp'
16
23
  autoload :Utils, 'rack/mount/utils'
24
+ autoload :Version, 'rack/mount/version'
17
25
 
18
26
  module Analysis #:nodoc:
19
- autoload :Frequency, 'rack/mount/analysis/frequency'
20
27
  autoload :Histogram, 'rack/mount/analysis/histogram'
21
28
  autoload :Splitting, 'rack/mount/analysis/splitting'
22
29
  end
23
-
24
- module Generation #:nodoc:
25
- autoload :Route, 'rack/mount/generation/route'
26
- autoload :RouteSet, 'rack/mount/generation/route_set'
27
- end
28
-
29
- module Recognition #:nodoc:
30
- autoload :CodeGeneration, 'rack/mount/recognition/code_generation'
31
- autoload :Route, 'rack/mount/recognition/route'
32
- autoload :RouteSet, 'rack/mount/recognition/route_set'
33
- end
34
30
  end
35
31
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-mount
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ hash: 57
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 8
9
+ - 3
10
+ version: 0.8.3
5
11
  platform: ruby
6
12
  authors:
7
13
  - Joshua Peek
@@ -9,67 +15,108 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-07-12 00:00:00 -05:00
18
+ date: 2011-08-30 00:00:00 -05:00
13
19
  default_executable:
14
20
  dependencies:
15
21
  - !ruby/object:Gem::Dependency
16
22
  name: rack
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
20
26
  requirements:
21
27
  - - ">="
22
28
  - !ruby/object:Gem::Version
29
+ hash: 23
30
+ segments:
31
+ - 1
32
+ - 0
33
+ - 0
23
34
  version: 1.0.0
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: multimap
27
35
  type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: racc
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
30
42
  requirements:
31
43
  - - ">="
32
44
  - !ruby/object:Gem::Version
33
- version: 1.0.0
34
- version:
35
- description: Stackable dynamic tree based Rack router
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :development
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: rake
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :development
64
+ version_requirements: *id003
65
+ - !ruby/object:Gem::Dependency
66
+ name: rexical
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ type: :development
78
+ version_requirements: *id004
79
+ description: " A stackable dynamic tree based Rack router.\n"
36
80
  email: josh@joshpeek.com
37
81
  executables: []
38
82
 
39
83
  extensions: []
40
84
 
41
- extra_rdoc_files:
85
+ extra_rdoc_files: []
86
+
87
+ files:
42
88
  - README.rdoc
43
89
  - LICENSE
44
- files:
45
- - lib/rack/mount/analysis/frequency.rb
46
90
  - lib/rack/mount/analysis/histogram.rb
47
91
  - lib/rack/mount/analysis/splitting.rb
48
- - lib/rack/mount/const.rb
49
- - lib/rack/mount/exceptions.rb
92
+ - lib/rack/mount/code_generation.rb
50
93
  - lib/rack/mount/generatable_regexp.rb
51
- - lib/rack/mount/generation/route.rb
52
- - lib/rack/mount/generation/route_set.rb
53
- - lib/rack/mount/meta_method.rb
54
- - lib/rack/mount/mixover.rb
55
94
  - lib/rack/mount/multimap.rb
56
95
  - lib/rack/mount/prefix.rb
57
- - lib/rack/mount/recognition/code_generation.rb
58
- - lib/rack/mount/recognition/route.rb
59
- - lib/rack/mount/recognition/route_set.rb
60
96
  - lib/rack/mount/regexp_with_named_groups.rb
61
97
  - lib/rack/mount/route.rb
62
98
  - lib/rack/mount/route_set.rb
99
+ - lib/rack/mount/strexp/parser.rb
100
+ - lib/rack/mount/strexp/tokenizer.rb
63
101
  - lib/rack/mount/strexp.rb
64
102
  - lib/rack/mount/utils.rb
65
- - lib/rack/mount/vendor/multimap/multimap.rb
66
- - lib/rack/mount/vendor/multimap/multiset.rb
67
- - lib/rack/mount/vendor/multimap/nested_multimap.rb
103
+ - lib/rack/mount/vendor/regin/regin/alternation.rb
104
+ - lib/rack/mount/vendor/regin/regin/anchor.rb
105
+ - lib/rack/mount/vendor/regin/regin/atom.rb
106
+ - lib/rack/mount/vendor/regin/regin/character.rb
107
+ - lib/rack/mount/vendor/regin/regin/character_class.rb
108
+ - lib/rack/mount/vendor/regin/regin/collection.rb
109
+ - lib/rack/mount/vendor/regin/regin/expression.rb
110
+ - lib/rack/mount/vendor/regin/regin/group.rb
111
+ - lib/rack/mount/vendor/regin/regin/options.rb
112
+ - lib/rack/mount/vendor/regin/regin/parser.rb
113
+ - lib/rack/mount/vendor/regin/regin/tokenizer.rb
114
+ - lib/rack/mount/vendor/regin/regin/version.rb
115
+ - lib/rack/mount/vendor/regin/regin.rb
116
+ - lib/rack/mount/version.rb
68
117
  - lib/rack/mount.rb
69
- - README.rdoc
70
- - LICENSE
71
118
  has_rdoc: true
72
- homepage: http://github.com/josh/rack-mount
119
+ homepage: https://github.com/josh/rack-mount
73
120
  licenses: []
74
121
 
75
122
  post_install_message:
@@ -78,21 +125,27 @@ rdoc_options: []
78
125
  require_paths:
79
126
  - lib
80
127
  required_ruby_version: !ruby/object:Gem::Requirement
128
+ none: false
81
129
  requirements:
82
130
  - - ">="
83
131
  - !ruby/object:Gem::Version
132
+ hash: 3
133
+ segments:
134
+ - 0
84
135
  version: "0"
85
- version:
86
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
+ none: false
87
138
  requirements:
88
139
  - - ">="
89
140
  - !ruby/object:Gem::Version
141
+ hash: 3
142
+ segments:
143
+ - 0
90
144
  version: "0"
91
- version:
92
145
  requirements: []
93
146
 
94
- rubyforge_project: rack-mount
95
- rubygems_version: 1.3.5
147
+ rubyforge_project:
148
+ rubygems_version: 1.5.2
96
149
  signing_key:
97
150
  specification_version: 3
98
151
  summary: Stackable dynamic tree based Rack router
@@ -1,51 +0,0 @@
1
- module Rack::Mount
2
- module Analysis
3
- class Frequency #:nodoc:
4
- extend Mixover
5
-
6
- def initialize(*keys)
7
- clear
8
- keys.each { |key| self << key }
9
- end
10
-
11
- def clear
12
- @raw_keys = []
13
- @key_frequency = Analysis::Histogram.new
14
- self
15
- end
16
-
17
- def <<(key)
18
- raise ArgumentError unless key.is_a?(Hash)
19
- @raw_keys << key
20
- nil
21
- end
22
-
23
- def possible_keys
24
- @possible_keys ||= begin
25
- @raw_keys.map do |key|
26
- key.inject({}) { |requirements, (method, requirement)|
27
- process_key(requirements, method, requirement)
28
- requirements
29
- }
30
- end
31
- end
32
- end
33
-
34
- def process_key(requirements, method, requirement)
35
- if requirement.is_a?(Regexp)
36
- requirements[method] = Utils.extract_static_regexp(requirement)
37
- else
38
- requirements[method] = requirement
39
- end
40
- end
41
-
42
- def report
43
- @report ||= begin
44
- possible_keys.each { |keys| keys.each_pair { |key, _| @key_frequency << key } }
45
- return [] if @key_frequency.count <= 1
46
- @key_frequency.select_upper
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,45 +0,0 @@
1
- module Rack::Mount
2
- module Const
3
- RACK_ROUTING_ARGS = 'rack.routing_args'.freeze
4
-
5
- begin
6
- eval('/(?<foo>.*)/').named_captures
7
- SUPPORTS_NAMED_CAPTURES = true
8
- REGEXP_NAMED_CAPTURE = '(?<%s>%s)'.freeze
9
- rescue SyntaxError, NoMethodError
10
- SUPPORTS_NAMED_CAPTURES = false
11
- REGEXP_NAMED_CAPTURE = '(?:<%s>%s)'.freeze
12
- end
13
-
14
- EMPTY_ARRAY = [].freeze
15
- EMPTY_HASH = {}.freeze
16
-
17
- NULL = "\0".freeze
18
-
19
- CONTENT_TYPE = 'Content-Type'.freeze
20
- CONTINUE = '100-continue'.freeze
21
- DELETE = 'PUT'.freeze
22
- EMPTY_STRING = ''.freeze
23
- EXPECT = 'Expect'.freeze
24
- GET = 'GET'.freeze
25
- HEAD = 'HEAD'.freeze
26
- PATH_INFO = 'PATH_INFO'.freeze
27
- POST = 'POST'.freeze
28
- PUT = 'PUT'.freeze
29
- REQUEST_METHOD = 'REQUEST_METHOD'.freeze
30
- SCRIPT_NAME = 'SCRIPT_NAME'.freeze
31
- SLASH = '/'.freeze
32
- TEXT_SLASH_HTML = 'text/html'.freeze
33
-
34
- DEFAULT_CONTENT_TYPE_HEADERS = {CONTENT_TYPE => TEXT_SLASH_HTML}.freeze
35
- HTTP_METHODS = [GET, HEAD, POST, PUT, DELETE].freeze
36
-
37
- OK = 'OK'.freeze
38
- NOT_FOUND = 'Not Found'.freeze
39
- EXPECTATION_FAILED = 'Expectation failed'.freeze
40
-
41
- OK_RESPONSE = [200, DEFAULT_CONTENT_TYPE_HEADERS, [OK].freeze].freeze
42
- NOT_FOUND_RESPONSE = [404, DEFAULT_CONTENT_TYPE_HEADERS, [NOT_FOUND].freeze].freeze
43
- EXPECTATION_FAILED_RESPONSE = [417, DEFAULT_CONTENT_TYPE_HEADERS, [EXPECTATION_FAILED].freeze].freeze
44
- end
45
- end
@@ -1,3 +0,0 @@
1
- module Rack::Mount
2
- class RoutingError < StandardError; end
3
- end