Class: Closed
- Inherits:
-
Object
- Object
- Closed
- Defined in:
- lib/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.
2 3 4 |
# File 'lib/closed.rb', line 2 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/closed.rb', line 6 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 |