rack-closed 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ module Rack
2
+ class Closed
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ def call(env)
8
+ hour = Time.now.hour
9
+
10
+ if hour < 9 || hour > 17
11
+ file = File.read("#{File.expand_path(File.dirname(__FILE__))}/views/closed.html")
12
+ [503, {"Content-Type" => "text/html"}, file]
13
+ else
14
+ @app.call(env)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1 @@
1
+ require "rack/closed"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 1
9
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Phil Lee
@@ -29,7 +29,8 @@ extra_rdoc_files: []
29
29
 
30
30
  files:
31
31
  - lib/views/closed.html
32
- - lib/closed.rb
32
+ - lib/rack/closed.rb
33
+ - lib/rack-closed.rb
33
34
  - LICENSE
34
35
  - README.textile
35
36
  has_rdoc: true
data/lib/closed.rb DELETED
@@ -1,16 +0,0 @@
1
- class Closed
2
- def initialize(app)
3
- @app = app
4
- end
5
-
6
- def call(env)
7
- hour = Time.now.hour
8
-
9
- if hour < 9 || hour > 17
10
- file = File.read("#{File.expand_path(File.dirname(__FILE__))}/views/closed.html")
11
- [503, {"Content-Type" => "text/html"}, file]
12
- else
13
- @app.call(env)
14
- end
15
- end
16
- end