newark 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/newark/app.rb +0 -1
- data/lib/newark/route.rb +5 -3
- data/lib/newark/version.rb +1 -1
- data/test/test_app.rb +1 -1
- data/test/test_request.rb +2 -2
- data/test/test_response.rb +1 -1
- data/test/test_router.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 846aac93a0c6b2c08f5ce424b677ff56fc6a4b92
|
4
|
+
data.tar.gz: d7265afa0ff668bab4b6b81e7b5bb0a99dd15d15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07a01715c7df2648363dc34df83eda6b4000f2dfd2bba48c6f47cb17b05aee2672214f5726181ae578e89ed7c2aaa8161214ef4caa2e1333cc8e48f4d16be442
|
7
|
+
data.tar.gz: cfd18aef273a3a3cf18ca952848c51da0e056e7e5e033daed91b67bd22a341a43de56457606b95bac002d4c3919928acffd0ac24ba86e70884ed9b01cd39092f
|
data/.gitignore
CHANGED
data/lib/newark/app.rb
CHANGED
data/lib/newark/route.rb
CHANGED
@@ -6,7 +6,7 @@ module Newark
|
|
6
6
|
PATH_MATCHER = /\*(?<path>.*)/.freeze
|
7
7
|
PATH_SUB = /\*.*/.freeze
|
8
8
|
|
9
|
-
attr_reader :handler
|
9
|
+
attr_reader :handler
|
10
10
|
|
11
11
|
def initialize(path, constraints, handler)
|
12
12
|
fail ArgumentError, 'You must define a route handler' if handler.nil?
|
@@ -18,8 +18,10 @@ module Newark
|
|
18
18
|
|
19
19
|
def match?(request)
|
20
20
|
path_data = path_match?(request)
|
21
|
-
|
22
|
-
|
21
|
+
(path_data && constraints_match?(request)).tap do |matched|
|
22
|
+
if matched
|
23
|
+
request.params.merge! Hash[ path_data.names.zip( path_data.captures ) ]
|
24
|
+
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
data/lib/newark/version.rb
CHANGED
data/test/test_app.rb
CHANGED
data/test/test_request.rb
CHANGED
@@ -25,7 +25,7 @@ class TestRequest < MiniTest::Unit::TestCase
|
|
25
25
|
include Rack::Test::Methods
|
26
26
|
|
27
27
|
def app
|
28
|
-
RequestApp.new
|
28
|
+
Rack::Lint.new(RequestApp.new)
|
29
29
|
end
|
30
30
|
|
31
31
|
def test_uri
|
@@ -44,7 +44,7 @@ class TestRequest < MiniTest::Unit::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def test_body
|
47
|
-
post '/body',
|
47
|
+
post '/body', 'fubar'
|
48
48
|
assert_equal 'fubar', last_response.body
|
49
49
|
end
|
50
50
|
|
data/test/test_response.rb
CHANGED
data/test/test_router.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newark
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|