Class: Rack::Closed
- Inherits:
-
Object
- Object
- Rack::Closed
- Defined in:
- lib/rack/closed.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Closed
constructor
A new instance of Closed.
Constructor Details
#initialize(app) ⇒ Closed
Returns a new instance of Closed.
3 4 5 |
# File 'lib/rack/closed.rb', line 3 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rack/closed.rb', line 7 def call(env) hour = Time.now.hour if hour < 9 || hour > 17 file = File.read("#{File.(File.dirname(__FILE__))}/views/closed.html") [503, {"Content-Type" => "text/html"}, file] else @app.call(env) end end |