monty 0.3.1 → 0.3.2
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.
- data/lib/monty.rb +1 -1
- data/lib/monty/watch.rb +13 -6
- metadata +3 -3
data/lib/monty.rb
CHANGED
data/lib/monty/watch.rb
CHANGED
@@ -2,10 +2,8 @@
|
|
2
2
|
|
3
3
|
module Monty
|
4
4
|
class Watch
|
5
|
-
def initialize(app
|
5
|
+
def initialize(app)
|
6
6
|
@app = app
|
7
|
-
|
8
|
-
instance_eval(&block) if block_given?
|
9
7
|
end
|
10
8
|
|
11
9
|
# Rack required method. For thread safety, dup self and execute _call
|
@@ -18,7 +16,7 @@ module Monty
|
|
18
16
|
delivery = Monty::Delivery.new(env)
|
19
17
|
|
20
18
|
unless delivery.allowed?
|
21
|
-
return [302, redirect_headers, []]
|
19
|
+
return [302, redirect_headers(env), []]
|
22
20
|
end
|
23
21
|
|
24
22
|
@app.call(env)
|
@@ -26,8 +24,17 @@ module Monty
|
|
26
24
|
|
27
25
|
private
|
28
26
|
|
29
|
-
def redirect_headers
|
30
|
-
{'Location' =>
|
27
|
+
def redirect_headers(env)
|
28
|
+
{'Location' => denied_path(env), 'Content-Type' => 'text/html'}
|
29
|
+
end
|
30
|
+
|
31
|
+
def denied_path(env)
|
32
|
+
path = Monty::Configuration.access_denied_path
|
33
|
+
if path.is_a?(String)
|
34
|
+
path
|
35
|
+
else
|
36
|
+
path.call(env)
|
37
|
+
end
|
31
38
|
end
|
32
39
|
end # Watch
|
33
40
|
end # Monty
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 2
|
9
|
+
version: 0.3.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- stonean
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-06-06 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|