Class: AlittleLess::RackApp
Constant Summary collapse
- SLOW_GET_THRESOLD =
0.2
- ID_CHARS =
'a'.upto('z').to_a + 'A'.upto('Z').to_a + '0'.upto('9').to_a
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(env) ⇒ RackApp
constructor
A new instance of RackApp.
Constructor Details
#initialize(env) ⇒ RackApp
Returns a new instance of RackApp.
12 13 14 |
# File 'lib/a_little_less/rack_app.rb', line 12 def initialize env @env = env end |
Class Method Details
.call(env) ⇒ Object
8 9 10 |
# File 'lib/a_little_less/rack_app.rb', line 8 def self.call env new(env).call end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/a_little_less/rack_app.rb', line 16 def call req = build_req req.id = rand_id resp = req.resp t0 = Time.now run_safe { log_req req } begin AlittleLessApp.new(req).conversation! rescue => e loge e Bugsnag.notify e resp.status = 500 end resp.headers['X-Runtime'] = Time.now - t0 run_safe { log_resp req } handle_body req, resp [ resp.status, resp.headers, resp.body ] end |