rack-app 0.8.2 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/rack/app.rb +2 -0
- data/lib/rack/app/endpoint.rb +2 -0
- data/lib/rack/app/router.rb +15 -8
- data/lib/rack/app/router/static.rb +4 -0
- 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: dde5ac113879f10a79548e3c815ce6df2ce1c1f4
|
4
|
+
data.tar.gz: 737dce792b8d47068228ff468e6a25db9224e377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3749bd9e51a5da2eead8467043088bfaa73d25952128366a098c09e24449691eed5771f2976e3bce79b481637d6e10dc92bb6af8aef686996c93ab722c99f5ca
|
7
|
+
data.tar.gz: abd365ac5e50dc6780a7171ae2e47bab25de55339fe92d7d61475d5ec8d6b4279d41b42dd996fa5ef5c08998e602f946e277a028503d9de9ba66a8556a04c7e5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.9.0
|
data/lib/rack/app.rb
CHANGED
data/lib/rack/app/endpoint.rb
CHANGED
data/lib/rack/app/router.rb
CHANGED
@@ -3,32 +3,39 @@ class Rack::App::Router
|
|
3
3
|
require 'rack/app/router/static'
|
4
4
|
require 'rack/app/router/dynamic'
|
5
5
|
|
6
|
+
#TD
|
7
|
+
def endpoint_paths
|
8
|
+
@static.endpoints.map do |indentifiers, endpoint|
|
9
|
+
[[*indentifiers].join("\t"),endpoint.properties[:description]].compact.join("\t\t\t")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
6
13
|
def add_endpoint(request_method, request_path, endpoint)
|
7
14
|
if defined_path_is_dynamic?(Rack::App::Utils.normalize_path(request_path))
|
8
|
-
@
|
15
|
+
@dynamic.add_endpoint(request_method, request_path, endpoint)
|
9
16
|
else
|
10
|
-
@
|
17
|
+
@static.add_endpoint(request_method, request_path, endpoint)
|
11
18
|
end
|
12
19
|
end
|
13
20
|
|
14
21
|
def fetch_endpoint(request_method, request_path)
|
15
|
-
@
|
16
|
-
@
|
22
|
+
@static.fetch_endpoint(request_method, request_path) or
|
23
|
+
@dynamic.fetch_endpoint(request_method, request_path) or
|
17
24
|
Rack::App::Endpoint::NOT_FOUND
|
18
25
|
end
|
19
26
|
|
20
27
|
def merge!(router)
|
21
28
|
raise(ArgumentError, "invalid router object, must be instance of #{self.class}") unless router.is_a?(self.class)
|
22
|
-
@
|
23
|
-
@
|
29
|
+
@static.merge!(router.instance_variable_get(:@static))
|
30
|
+
@dynamic.merge!(router.instance_variable_get(:@dynamic))
|
24
31
|
nil
|
25
32
|
end
|
26
33
|
|
27
34
|
protected
|
28
35
|
|
29
36
|
def initialize
|
30
|
-
@
|
31
|
-
@
|
37
|
+
@static = Rack::App::Router::Static.new
|
38
|
+
@dynamic = Rack::App::Router::Dynamic.new
|
32
39
|
end
|
33
40
|
|
34
41
|
def defined_path_is_dynamic?(path_str)
|
@@ -1,5 +1,8 @@
|
|
1
1
|
class Rack::App::Router::Static
|
2
2
|
|
3
|
+
#TD
|
4
|
+
attr_reader :endpoints
|
5
|
+
|
3
6
|
def add_endpoint(request_method, request_path, endpoint)
|
4
7
|
@endpoints[[request_method.to_s.upcase, Rack::App::Utils.normalize_path(request_path)]]= endpoint
|
5
8
|
end
|
@@ -14,6 +17,7 @@ class Rack::App::Router::Static
|
|
14
17
|
nil
|
15
18
|
end
|
16
19
|
|
20
|
+
|
17
21
|
protected
|
18
22
|
|
19
23
|
def initialize
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|