class ActionCost::Middleware

Middleware responsability is to initialize and close RequestStats object at start and end of HTTP query.

Public Class Methods

accumulated_stats() click to toggle source
# File lib/action_cost/middleware.rb, line 59
def self.accumulated_stats
  action_cost_data.accumulated_stats
end
action_cost_data() click to toggle source
# File lib/action_cost/middleware.rb, line 44
def self.action_cost_data
  $action_cost_data
end
new(app) click to toggle source
# File lib/action_cost/middleware.rb, line 40
def initialize(app)
  @app = app
end
push_sql_parser(parser) click to toggle source
# File lib/action_cost/middleware.rb, line 55
def self.push_sql_parser(parser)
  action_cost_data.push_sql_parser(parser)
end

Public Instance Methods

call(env) click to toggle source
# File lib/action_cost/middleware.rb, line 48
def call(env)
  self.class.action_cost_data.start_request(env)
  @app.call(env)
ensure
  self.class.action_cost_data.end_request
end