strong_routes 0.9.3 → 0.9.4
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.
- checksums.yaml +4 -4
- data/lib/strong_routes/allow.rb +8 -4
- data/lib/strong_routes/version.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: b116b59eb73f3c72bef5bc449e556dd5c1bfe649
|
|
4
|
+
data.tar.gz: f1af77b8e1dd91216dae5aedf2948603f205faf0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2f08941062497b8a02c2f91f42f989dfff8f53e5ccb5d30a77fea49c4debb57873987a13df09f65bad5f50816c43b68e40e7937766e0f86236a5965e5ecb54d
|
|
7
|
+
data.tar.gz: 9106b104c24facc56b9d527da3ce70e03e8a500e9fbc7b756d24e64b1d933d2a7c51ae4cd4ddbee26372f5649b2ac31b3b4fe0c106307fe9de00f24bcd6e1e4f
|
data/lib/strong_routes/allow.rb
CHANGED
|
@@ -2,7 +2,7 @@ module StrongRoutes
|
|
|
2
2
|
class Allow
|
|
3
3
|
def initialize(app, options = {})
|
|
4
4
|
@app = app
|
|
5
|
-
@options =
|
|
5
|
+
@options = options
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def call(env)
|
|
@@ -13,7 +13,7 @@ module StrongRoutes
|
|
|
13
13
|
if allowed?(request)
|
|
14
14
|
@app.call(env)
|
|
15
15
|
else
|
|
16
|
-
[ 404, { "Content-Type" => "text/html", "Content-Length" =>
|
|
16
|
+
[ 404, { "Content-Type" => "text/html", "Content-Length" => config.message.length }, [ config.message ] ]
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ module StrongRoutes
|
|
|
21
21
|
|
|
22
22
|
def allowed_routes
|
|
23
23
|
@allowed_routes ||= begin
|
|
24
|
-
routes = [
|
|
24
|
+
routes = [ config.allowed_routes ]
|
|
25
25
|
routes.flatten!
|
|
26
26
|
routes.compact!
|
|
27
27
|
routes.uniq!
|
|
@@ -33,8 +33,12 @@ module StrongRoutes
|
|
|
33
33
|
route_matchers.any? { |route_matcher| route_matcher =~ request.path_info }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
+
def config
|
|
37
|
+
@config ||= StrongRoutes.config.merge(@options)
|
|
38
|
+
end
|
|
39
|
+
|
|
36
40
|
def enabled?
|
|
37
|
-
|
|
41
|
+
config.enabled?
|
|
38
42
|
end
|
|
39
43
|
|
|
40
44
|
def route_matchers
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: strong_routes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Hutchison
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-02-
|
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|