mustermann 0.3.0 → 0.4.0

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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +429 -665
  3. data/lib/mustermann/ast/boundaries.rb +44 -0
  4. data/lib/mustermann/ast/compiler.rb +13 -7
  5. data/lib/mustermann/ast/expander.rb +22 -12
  6. data/lib/mustermann/ast/node.rb +69 -5
  7. data/lib/mustermann/ast/param_scanner.rb +20 -0
  8. data/lib/mustermann/ast/parser.rb +138 -19
  9. data/lib/mustermann/ast/pattern.rb +59 -7
  10. data/lib/mustermann/ast/template_generator.rb +28 -0
  11. data/lib/mustermann/ast/transformer.rb +2 -2
  12. data/lib/mustermann/ast/translator.rb +22 -8
  13. data/lib/mustermann/ast/validation.rb +4 -3
  14. data/lib/mustermann/composite.rb +101 -0
  15. data/lib/mustermann/expander.rb +2 -2
  16. data/lib/mustermann/identity.rb +56 -0
  17. data/lib/mustermann/pattern.rb +187 -10
  18. data/lib/mustermann/pattern_cache.rb +49 -0
  19. data/lib/mustermann/regexp.rb +1 -0
  20. data/lib/mustermann/regexp_based.rb +18 -1
  21. data/lib/mustermann/regular.rb +4 -1
  22. data/lib/mustermann/simple_match.rb +5 -0
  23. data/lib/mustermann/sinatra.rb +22 -5
  24. data/lib/mustermann/to_pattern.rb +11 -6
  25. data/lib/mustermann/version.rb +1 -1
  26. data/lib/mustermann.rb +95 -20
  27. data/mustermann.gemspec +1 -14
  28. data/spec/ast_spec.rb +14 -0
  29. data/spec/composite_spec.rb +147 -0
  30. data/spec/expander_spec.rb +15 -0
  31. data/spec/identity_spec.rb +44 -0
  32. data/spec/mustermann_spec.rb +21 -2
  33. data/spec/pattern_spec.rb +7 -3
  34. data/spec/regular_spec.rb +25 -0
  35. data/spec/sinatra_spec.rb +184 -9
  36. data/spec/to_pattern_spec.rb +49 -0
  37. metadata +15 -180
  38. data/.gitignore +0 -18
  39. data/.rspec +0 -2
  40. data/.travis.yml +0 -10
  41. data/.yardopts +0 -1
  42. data/Gemfile +0 -2
  43. data/LICENSE +0 -22
  44. data/Rakefile +0 -6
  45. data/internals.md +0 -64
  46. data/lib/mustermann/ast/tree_renderer.rb +0 -29
  47. data/lib/mustermann/rails.rb +0 -17
  48. data/lib/mustermann/shell.rb +0 -29
  49. data/lib/mustermann/simple.rb +0 -35
  50. data/lib/mustermann/template.rb +0 -47
  51. data/spec/rails_spec.rb +0 -521
  52. data/spec/shell_spec.rb +0 -108
  53. data/spec/simple_spec.rb +0 -236
  54. data/spec/support/coverage.rb +0 -16
  55. data/spec/support/env.rb +0 -16
  56. data/spec/support/expand_matcher.rb +0 -27
  57. data/spec/support/match_matcher.rb +0 -39
  58. data/spec/support/pattern.rb +0 -39
  59. data/spec/support.rb +0 -5
  60. data/spec/template_spec.rb +0 -814
data/spec/sinatra_spec.rb CHANGED
@@ -7,6 +7,11 @@ describe Mustermann::Sinatra do
7
7
  pattern '' do
8
8
  it { should match('') }
9
9
  it { should_not match('/') }
10
+
11
+ it { should generate_template('') }
12
+
13
+ it { should respond_to(:expand) }
14
+ it { should respond_to(:to_templates) }
10
15
  end
11
16
 
12
17
  pattern '/' do
@@ -43,6 +48,8 @@ describe Mustermann::Sinatra do
43
48
  it { should_not match('/foo/bar') }
44
49
  it { should_not match('/') }
45
50
  it { should_not match('/foo/') }
51
+
52
+ it { should generate_template('/{foo}') }
46
53
  end
47
54
 
48
55
  pattern '/föö' do
@@ -61,10 +68,34 @@ describe Mustermann::Sinatra do
61
68
 
62
69
  example { pattern.params('/bar/foo').should be == {"foo" => "bar", "bar" => "foo"} }
63
70
  example { pattern.params('').should be_nil }
71
+
72
+ it { should generate_template('/{foo}/{bar}') }
73
+ end
74
+
75
+ pattern "/{foo}/{bar}" do
76
+ it { should match('/foo/bar') .capturing foo: 'foo', bar: 'bar' }
77
+ it { should match('/foo.bar/bar.foo') .capturing foo: 'foo.bar', bar: 'bar.foo' }
78
+ it { should match('/user@example.com/name') .capturing foo: 'user@example.com', bar: 'name' }
79
+ it { should match('/10.1/te.st') .capturing foo: '10.1', bar: 'te.st' }
80
+ it { should match('/10.1.2/te.st') .capturing foo: '10.1.2', bar: 'te.st' }
81
+
82
+ it { should_not match('/foo%2Fbar') }
83
+ it { should_not match('/foo%2fbar') }
84
+
85
+ example { pattern.params('/bar/foo').should be == {"foo" => "bar", "bar" => "foo"} }
86
+ example { pattern.params('').should be_nil }
87
+
88
+ it { should generate_template('/{foo}/{bar}') }
64
89
  end
65
90
 
66
91
  pattern '/hello/:person' do
67
92
  it { should match('/hello/Frank').capturing person: 'Frank' }
93
+ it { should generate_template('/hello/{person}') }
94
+ end
95
+
96
+ pattern '/hello/{person}' do
97
+ it { should match('/hello/Frank').capturing person: 'Frank' }
98
+ it { should generate_template('/hello/{person}') }
68
99
  end
69
100
 
70
101
  pattern '/?:foo?/?:bar?' do
@@ -73,23 +104,40 @@ describe Mustermann::Sinatra do
73
104
  it { should match('/') .capturing foo: nil, bar: nil }
74
105
  it { should match('') .capturing foo: nil, bar: nil }
75
106
 
76
- it { should_not match('/hello/world/') }
107
+ it { should expand(foo: 'hello') .to('/hello/') }
108
+ it { should expand(foo: 'hello', bar: 'world') .to('/hello/world') }
109
+ it { should expand(bar: 'world') .to('//world') }
110
+ it { should expand .to('//') }
111
+ it { should_not expand(baz: '') }
77
112
 
78
- # it { should expand(foo: 'hello') .to('/hello') }
79
- # it { should expand(foo: 'hello', bar: 'world') .to('/hello/world') }
80
- # it { should expand(bar: 'world') .to('//world') }
81
- # it { should expand .to('') }
82
- # it { should_not expand(baz: '') }
113
+ it { should_not match('/hello/world/') }
114
+ it { should generate_templates("", "/", "//", "//{bar}", "/{bar}", "/{foo}", "/{foo}/", "/{foo}/{bar}", "/{foo}{bar}", "{bar}", "{foo}", "{foo}/", "{foo}/{bar}", "{foo}{bar}") }
83
115
  end
84
116
 
85
117
  pattern '/:foo_bar' do
86
118
  it { should match('/hello').capturing foo_bar: 'hello' }
119
+ it { should generate_template('/{foo_bar}') }
120
+ end
121
+
122
+ pattern '/{foo.bar}' do
123
+ it { should match('/hello').capturing :"foo.bar" => 'hello' }
124
+ it { should generate_template('/{foo.bar}') }
87
125
  end
88
126
 
89
127
  pattern '/*' do
90
128
  it { should match('/') .capturing splat: '' }
91
129
  it { should match('/foo') .capturing splat: 'foo' }
92
130
  it { should match('/foo/bar') .capturing splat: 'foo/bar' }
131
+ it { should generate_template('/{+splat}') }
132
+
133
+ example { pattern.params('/foo').should be == {"splat" => ["foo"]} }
134
+ end
135
+
136
+ pattern '/{+splat}' do
137
+ it { should match('/') .capturing splat: '' }
138
+ it { should match('/foo') .capturing splat: 'foo' }
139
+ it { should match('/foo/bar') .capturing splat: 'foo/bar' }
140
+ it { should generate_template('/{+splat}') }
93
141
 
94
142
  example { pattern.params('/foo').should be == {"splat" => ["foo"]} }
95
143
  end
@@ -98,6 +146,17 @@ describe Mustermann::Sinatra do
98
146
  it { should match('/') .capturing foo: '' }
99
147
  it { should match('/foo') .capturing foo: 'foo' }
100
148
  it { should match('/foo/bar') .capturing foo: 'foo/bar' }
149
+ it { should generate_template('/{+foo}') }
150
+
151
+ example { pattern.params('/foo') .should be == {"foo" => "foo" } }
152
+ example { pattern.params('/foo/bar') .should be == {"foo" => "foo/bar" } }
153
+ end
154
+
155
+ pattern '/{+foo}' do
156
+ it { should match('/') .capturing foo: '' }
157
+ it { should match('/foo') .capturing foo: 'foo' }
158
+ it { should match('/foo/bar') .capturing foo: 'foo/bar' }
159
+ it { should generate_template('/{+foo}') }
101
160
 
102
161
  example { pattern.params('/foo') .should be == {"foo" => "foo" } }
103
162
  example { pattern.params('/foo/bar') .should be == {"foo" => "foo/bar" } }
@@ -105,6 +164,12 @@ describe Mustermann::Sinatra do
105
164
 
106
165
  pattern '/*foo/*bar' do
107
166
  it { should match('/foo/bar') .capturing foo: 'foo', bar: 'bar' }
167
+ it { should generate_template('/{+foo}/{+bar}') }
168
+ end
169
+
170
+ pattern '/{+foo}/{+bar}' do
171
+ it { should match('/foo/bar') .capturing foo: 'foo', bar: 'bar' }
172
+ it { should generate_template('/{+foo}/{+bar}') }
108
173
  end
109
174
 
110
175
  pattern '/:foo/*' do
@@ -112,6 +177,18 @@ describe Mustermann::Sinatra do
112
177
  it { should match("/foo/") .capturing foo: 'foo', splat: '' }
113
178
  it { should match('/h%20w/h%20a%20y') .capturing foo: 'h%20w', splat: 'h%20a%20y' }
114
179
  it { should_not match('/foo') }
180
+ it { should generate_template('/{foo}/{+splat}') }
181
+
182
+ example { pattern.params('/bar/foo').should be == {"splat" => ["foo"], "foo" => "bar"} }
183
+ example { pattern.params('/bar/foo/f%20o').should be == {"splat" => ["foo/f o"], "foo" => "bar"} }
184
+ end
185
+
186
+ pattern '/{foo}/*' do
187
+ it { should match("/foo/bar/baz") .capturing foo: 'foo', splat: 'bar/baz' }
188
+ it { should match("/foo/") .capturing foo: 'foo', splat: '' }
189
+ it { should match('/h%20w/h%20a%20y') .capturing foo: 'h%20w', splat: 'h%20a%20y' }
190
+ it { should_not match('/foo') }
191
+ it { should generate_template('/{foo}/{+splat}') }
115
192
 
116
193
  example { pattern.params('/bar/foo').should be == {"splat" => ["foo"], "foo" => "bar"} }
117
194
  example { pattern.params('/bar/foo/f%20o').should be == {"splat" => ["foo/f o"], "foo" => "bar"} }
@@ -131,12 +208,18 @@ describe Mustermann::Sinatra do
131
208
  it { should match('/path%20with%20spaces') }
132
209
  it { should match('/path%2Bwith%2Bspaces') }
133
210
  it { should match('/path+with+spaces') }
211
+
212
+ it { should generate_template('/path%20with%20spaces') }
134
213
  end
135
214
 
136
215
  pattern '/foo&bar' do
137
216
  it { should match('/foo&bar') }
138
217
  end
139
218
 
219
+ pattern '/foo\{bar' do
220
+ it { should match('/foo%7Bbar') }
221
+ end
222
+
140
223
  pattern '/*/:foo/*/*' do
141
224
  it { should match('/bar/foo/bling/baz/boom') }
142
225
 
@@ -153,13 +236,29 @@ describe Mustermann::Sinatra do
153
236
  end
154
237
  end
155
238
 
239
+ pattern '/{+splat}/{foo}/{+splat}/{+splat}' do
240
+ it { should match('/bar/foo/bling/baz/boom') }
241
+
242
+ it "should capture all splat parts" do
243
+ match = pattern.match('/bar/foo/bling/baz/boom')
244
+ match.captures.should be == ['bar', 'foo', 'bling', 'baz/boom']
245
+ match.names.should be == ['splat', 'foo']
246
+ end
247
+
248
+ it 'should map to proper params' do
249
+ pattern.params('/bar/foo/bling/baz/boom').should be == {
250
+ "foo" => "foo", "splat" => ['bar', 'bling', 'baz/boom']
251
+ }
252
+ end
253
+ end
254
+
156
255
  pattern '/test.bar' do
157
256
  it { should match('/test.bar') }
158
257
  it { should_not match('/test0bar') }
159
258
  end
160
259
 
161
260
  pattern '/:file.:ext' do
162
- it { should match('/pony.jpg') .capturing file: 'pony', ext: 'jpg' }
261
+ it { should match('/pony.jpg') .capturing file: 'pony', ext: 'jpg' }
163
262
  it { should match('/pony%2Ejpg') .capturing file: 'pony', ext: 'jpg' }
164
263
  it { should match('/pony%2ejpg') .capturing file: 'pony', ext: 'jpg' }
165
264
 
@@ -179,12 +278,18 @@ describe Mustermann::Sinatra do
179
278
  it { should match('/ax') .capturing a: 'a' }
180
279
  it { should match('/axax') .capturing a: 'axa' }
181
280
  it { should match('/axaxx') .capturing a: 'axax' }
281
+
282
+ it { should generate_template('/{a}x') }
283
+ it { should generate_template('/{a}') }
182
284
  end
183
285
 
184
286
  pattern '/:user(@:host)?' do
185
287
  it { should match('/foo@bar') .capturing user: 'foo', host: 'bar' }
186
288
  it { should match('/foo.foo@bar') .capturing user: 'foo.foo', host: 'bar' }
187
289
  it { should match('/foo@bar.bar') .capturing user: 'foo', host: 'bar.bar' }
290
+
291
+ it { should generate_template('/{user}') }
292
+ it { should generate_template('/{user}@{host}') }
188
293
  end
189
294
 
190
295
  pattern '/:file(.:ext)?' do
@@ -195,6 +300,10 @@ describe Mustermann::Sinatra do
195
300
  it { should match('/pony.png.jpg') .capturing file: 'pony.png', ext: 'jpg' }
196
301
  it { should match('/pony.') .capturing file: 'pony.' }
197
302
  it { should_not match('/.jpg') }
303
+
304
+ it { should generate_template('/{file}') }
305
+ it { should generate_template('/{file}.{ext}') }
306
+ it { should_not generate_template('/{file}.') }
198
307
  end
199
308
 
200
309
  pattern '/:id/test.bar' do
@@ -323,6 +432,37 @@ describe Mustermann::Sinatra do
323
432
  it { should match('/foo/bar/baz').capturing foo: 'foo', bar: 'bar', baz: 'baz' }
324
433
  end
325
434
 
435
+ pattern "/(foo|bar)" do
436
+ it { should match("/foo") }
437
+ it { should match("/bar") }
438
+
439
+ it { should generate_template('/foo') }
440
+ it { should generate_template('/bar') }
441
+ end
442
+
443
+ pattern "/(foo\\|bar)" do
444
+ it { should match "/foo%7Cbar" }
445
+ it { should generate_template "/foo%7Cbar" }
446
+
447
+ it { should_not match("/foo") }
448
+ it { should_not match("/bar") }
449
+
450
+ it { should_not generate_template('/foo') }
451
+ it { should_not generate_template('/bar') }
452
+ end
453
+
454
+ pattern "/(:a/:b|:c)" do
455
+ it { should match("/foo") .capturing c: 'foo' }
456
+ it { should match("/foo/bar") .capturing a: 'foo', b: 'bar' }
457
+
458
+ it { should generate_template('/{a}/{b}') }
459
+ it { should generate_template('/{c}') }
460
+
461
+ it { should expand(a: 'foo', b: 'bar') .to('/foo/bar') }
462
+ it { should expand(c: 'foo') .to('/foo') }
463
+ it { should_not expand(a: 'foo', b: 'bar', c: 'baz') }
464
+ end
465
+
326
466
  pattern '/:foo', capture: /\d+/ do
327
467
  it { should match('/1') .capturing foo: '1' }
328
468
  it { should match('/123') .capturing foo: '123' }
@@ -508,6 +648,11 @@ describe Mustermann::Sinatra do
508
648
  to raise_error(Mustermann::ParseError, 'unexpected ? while parsing "foo??bar"')
509
649
  end
510
650
 
651
+ example '| outside of group' do
652
+ expect { Mustermann::Sinatra.new('foo|bar') }.
653
+ to raise_error(Mustermann::ParseError, 'unexpected | while parsing "foo|bar"')
654
+ end
655
+
511
656
  example 'dangling escape' do
512
657
  expect { Mustermann::Sinatra.new('foo\\') }.
513
658
  to raise_error(Mustermann::ParseError, 'unexpected end of string while parsing "foo\\\\"')
@@ -563,11 +708,41 @@ describe Mustermann::Sinatra do
563
708
  end
564
709
 
565
710
  describe :to_regexp do
566
- example('empty pattern') { Mustermann::Sinatra.new('').to_regexp.should be == /\A\Z/ }
711
+ example('empty pattern') { Mustermann::Sinatra.new('').to_regexp.should be == /\A(?-mix:)\Z/ }
567
712
 
568
713
  context 'Regexp.try_convert' do
569
- example('empty pattern') { Regexp.try_convert(Mustermann::Sinatra.new('')).should be == /\A\Z/ }
714
+ example('empty pattern') { Regexp.try_convert(Mustermann::Sinatra.new('')).should be == /\A(?-mix:)\Z/ }
570
715
  end
571
716
  end
572
717
  end
718
+
719
+ context 'Proc compatibility' do
720
+ describe :to_proc do
721
+ example { Mustermann::Sinatra.new("/").to_proc.should be_a(Proc) }
722
+ example('non-matching') { Mustermann::Sinatra.new("/") .to_proc.call('/foo').should be == false }
723
+ example('matching') { Mustermann::Sinatra.new("/:foo") .to_proc.call('/foo').should be == true }
724
+ end
725
+ end
726
+
727
+ context "peeking" do
728
+ subject(:pattern) { Mustermann::Sinatra.new(":name") }
729
+
730
+ describe :peek_size do
731
+ example { pattern.peek_size("foo bar/blah") .should be == "foo bar".size }
732
+ example { pattern.peek_size("foo%20bar/blah") .should be == "foo%20bar".size }
733
+ example { pattern.peek_size("/foo bar") .should be_nil }
734
+ end
735
+
736
+ describe :peek_match do
737
+ example { pattern.peek_match("foo bar/blah") .to_s .should be == "foo bar" }
738
+ example { pattern.peek_match("foo%20bar/blah") .to_s .should be == "foo%20bar" }
739
+ example { pattern.peek_match("/foo bar") .should be_nil }
740
+ end
741
+
742
+ describe :peek_params do
743
+ example { pattern.peek_params("foo bar/blah") .should be == [{"name" => "foo bar"}, "foo bar".size] }
744
+ example { pattern.peek_params("foo%20bar/blah") .should be == [{"name" => "foo bar"}, "foo%20bar".size] }
745
+ example { pattern.peek_params("/foo bar") .should be_nil }
746
+ end
747
+ end
573
748
  end
@@ -1,5 +1,6 @@
1
1
  require 'support'
2
2
  require 'mustermann/to_pattern'
3
+ require 'delegate'
3
4
 
4
5
  describe Mustermann::ToPattern do
5
6
  context String do
@@ -12,9 +13,57 @@ describe Mustermann::ToPattern do
12
13
  example { //.to_pattern(type: :rails) .should be_a(Mustermann::Regular) }
13
14
  end
14
15
 
16
+ context Symbol do
17
+ example { :foo.to_pattern .should be_a(Mustermann::Sinatra) }
18
+ example { :foo.to_pattern(type: :rails) .should be_a(Mustermann::Sinatra) }
19
+ end
20
+
21
+ context Array do
22
+ example { [:foo, :bar].to_pattern .should be_a(Mustermann::Composite) }
23
+ example { [:foo, :bar].to_pattern(type: :rails) .should be_a(Mustermann::Composite) }
24
+ end
25
+
15
26
  context Mustermann::Pattern do
16
27
  subject(:pattern) { Mustermann.new('') }
17
28
  example { pattern.to_pattern.should be == pattern }
18
29
  example { pattern.to_pattern(type: :rails).should be_a(Mustermann::Sinatra) }
19
30
  end
31
+
32
+ context 'custom class' do
33
+ let(:example_class) do
34
+ Class.new do
35
+ include Mustermann::ToPattern
36
+ def to_s
37
+ ":foo/:bar"
38
+ end
39
+ end
40
+ end
41
+
42
+ example { example_class.new.to_pattern .should be_a(Mustermann::Sinatra) }
43
+ example { example_class.new.to_pattern(type: :rails) .should be_a(Mustermann::Rails) }
44
+ example { Mustermann.new(example_class.new) .should be_a(Mustermann::Sinatra) }
45
+ example { Mustermann.new(example_class.new, type: :rails) .should be_a(Mustermann::Rails) }
46
+ end
47
+
48
+ context 'primitive delegate' do
49
+ let(:example_class) do
50
+ Class.new(DelegateClass(Array)) do
51
+ include Mustermann::ToPattern
52
+ end
53
+ end
54
+
55
+ example { example_class.new([:foo, :bar]).to_pattern .should be_a(Mustermann::Composite) }
56
+ example { example_class.new([:foo, :bar]).to_pattern(type: :rails) .should be_a(Mustermann::Composite) }
57
+ end
58
+
59
+ context 'primitive subclass' do
60
+ let(:example_class) do
61
+ Class.new(Array) do
62
+ include Mustermann::ToPattern
63
+ end
64
+ end
65
+
66
+ example { example_class.new([:foo, :bar]).to_pattern .should be_a(Mustermann::Composite) }
67
+ example { example_class.new([:foo, :bar]).to_pattern(type: :rails) .should be_a(Mustermann::Composite) }
68
+ end
20
69
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustermann
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tool
@@ -24,220 +24,63 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.2'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec-its
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: addressable
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: sinatra
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.4'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.4'
83
- - !ruby/object:Gem::Dependency
84
- name: rack-test
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rake
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: yard
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: redcarpet
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: simplecov
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: '0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - ">="
151
- - !ruby/object:Gem::Version
152
- version: '0'
153
- - !ruby/object:Gem::Dependency
154
- name: coveralls
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ">="
158
- - !ruby/object:Gem::Version
159
- version: '0'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ">="
165
- - !ruby/object:Gem::Version
166
- version: '0'
167
27
  description: library implementing patterns that behave like regular expressions
168
28
  email: konstantin.mailinglists@googlemail.com
169
29
  executables: []
170
30
  extensions: []
171
- extra_rdoc_files:
172
- - README.md
173
- - internals.md
31
+ extra_rdoc_files: []
174
32
  files:
175
- - ".gitignore"
176
- - ".rspec"
177
- - ".travis.yml"
178
- - ".yardopts"
179
- - Gemfile
180
- - LICENSE
181
33
  - README.md
182
- - Rakefile
183
34
  - bench/capturing.rb
184
35
  - bench/regexp.rb
185
36
  - bench/simple_vs_sinatra.rb
186
37
  - bench/template_vs_addressable.rb
187
- - internals.md
188
38
  - lib/mustermann.rb
39
+ - lib/mustermann/ast/boundaries.rb
189
40
  - lib/mustermann/ast/compiler.rb
190
41
  - lib/mustermann/ast/expander.rb
191
42
  - lib/mustermann/ast/node.rb
43
+ - lib/mustermann/ast/param_scanner.rb
192
44
  - lib/mustermann/ast/parser.rb
193
45
  - lib/mustermann/ast/pattern.rb
46
+ - lib/mustermann/ast/template_generator.rb
194
47
  - lib/mustermann/ast/transformer.rb
195
48
  - lib/mustermann/ast/translator.rb
196
- - lib/mustermann/ast/tree_renderer.rb
197
49
  - lib/mustermann/ast/validation.rb
198
50
  - lib/mustermann/caster.rb
51
+ - lib/mustermann/composite.rb
199
52
  - lib/mustermann/error.rb
200
53
  - lib/mustermann/expander.rb
201
54
  - lib/mustermann/extension.rb
202
55
  - lib/mustermann/identity.rb
203
56
  - lib/mustermann/mapper.rb
204
57
  - lib/mustermann/pattern.rb
205
- - lib/mustermann/rails.rb
58
+ - lib/mustermann/pattern_cache.rb
59
+ - lib/mustermann/regexp.rb
206
60
  - lib/mustermann/regexp_based.rb
207
61
  - lib/mustermann/regular.rb
208
62
  - lib/mustermann/router.rb
209
63
  - lib/mustermann/router/rack.rb
210
64
  - lib/mustermann/router/simple.rb
211
- - lib/mustermann/shell.rb
212
- - lib/mustermann/simple.rb
213
65
  - lib/mustermann/simple_match.rb
214
66
  - lib/mustermann/sinatra.rb
215
- - lib/mustermann/template.rb
216
67
  - lib/mustermann/to_pattern.rb
217
68
  - lib/mustermann/version.rb
218
69
  - mustermann.gemspec
70
+ - spec/ast_spec.rb
71
+ - spec/composite_spec.rb
219
72
  - spec/expander_spec.rb
220
73
  - spec/extension_spec.rb
221
74
  - spec/identity_spec.rb
222
75
  - spec/mapper_spec.rb
223
76
  - spec/mustermann_spec.rb
224
77
  - spec/pattern_spec.rb
225
- - spec/rails_spec.rb
226
78
  - spec/regexp_based_spec.rb
227
79
  - spec/regular_spec.rb
228
80
  - spec/router/rack_spec.rb
229
81
  - spec/router/simple_spec.rb
230
- - spec/shell_spec.rb
231
82
  - spec/simple_match_spec.rb
232
- - spec/simple_spec.rb
233
83
  - spec/sinatra_spec.rb
234
- - spec/support.rb
235
- - spec/support/coverage.rb
236
- - spec/support/env.rb
237
- - spec/support/expand_matcher.rb
238
- - spec/support/match_matcher.rb
239
- - spec/support/pattern.rb
240
- - spec/template_spec.rb
241
84
  - spec/to_pattern_spec.rb
242
85
  homepage: https://github.com/rkh/mustermann
243
86
  licenses:
@@ -251,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
251
94
  requirements:
252
95
  - - ">="
253
96
  - !ruby/object:Gem::Version
254
- version: 2.0.0
97
+ version: 2.1.0
255
98
  required_rubygems_version: !ruby/object:Gem::Requirement
256
99
  requirements:
257
100
  - - ">="
@@ -259,32 +102,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
102
  version: '0'
260
103
  requirements: []
261
104
  rubyforge_project:
262
- rubygems_version: 2.2.2
105
+ rubygems_version: 2.4.3
263
106
  signing_key:
264
107
  specification_version: 4
265
108
  summary: use patterns like regular expressions
266
109
  test_files:
110
+ - spec/ast_spec.rb
111
+ - spec/composite_spec.rb
267
112
  - spec/expander_spec.rb
268
113
  - spec/extension_spec.rb
269
114
  - spec/identity_spec.rb
270
115
  - spec/mapper_spec.rb
271
116
  - spec/mustermann_spec.rb
272
117
  - spec/pattern_spec.rb
273
- - spec/rails_spec.rb
274
118
  - spec/regexp_based_spec.rb
275
119
  - spec/regular_spec.rb
276
120
  - spec/router/rack_spec.rb
277
121
  - spec/router/simple_spec.rb
278
- - spec/shell_spec.rb
279
122
  - spec/simple_match_spec.rb
280
- - spec/simple_spec.rb
281
123
  - spec/sinatra_spec.rb
282
- - spec/support.rb
283
- - spec/support/coverage.rb
284
- - spec/support/env.rb
285
- - spec/support/expand_matcher.rb
286
- - spec/support/match_matcher.rb
287
- - spec/support/pattern.rb
288
- - spec/template_spec.rb
289
124
  - spec/to_pattern_spec.rb
290
125
  has_rdoc: