monty 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/monty.rb +1 -1
  2. data/lib/monty/watch.rb +13 -6
  3. metadata +3 -3
@@ -6,7 +6,7 @@ module Monty
6
6
  class << self
7
7
  # App version
8
8
  def version
9
- '0.3.1'
9
+ '0.3.2'
10
10
  end
11
11
 
12
12
  # @return [Regexp] with \A \z boundaries
@@ -2,10 +2,8 @@
2
2
 
3
3
  module Monty
4
4
  class Watch
5
- def initialize(app, &block)
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' => Monty::Configuration.access_denied_path, 'Content-Type' => 'text/html'}
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
- - 1
9
- version: 0.3.1
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-05-27 00:00:00 -04:00
17
+ date: 2010-06-06 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency