Class: NineToFive::Middleware
- Inherits:
-
Object
- Object
- NineToFive::Middleware
- Defined in:
- lib/nine_to_five.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) ⇒ Middleware
Returns a new instance of Middleware.
15 16 17 |
# File 'lib/nine_to_five.rb', line 15 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nine_to_five.rb', line 19 def call(env) current_time = Time.current start_time = current_time.change(hour: NineToFive.start_hour) end_time = current_time.change(hour: NineToFive.end_hour) if current_time.between? start_time, end_time @app.call(env) else [403, {"Content-Type" => "text/html"}, [NineToFive.response]] end end |