Sha256: 51ea426695b03e45e7856ec2ee7f70626150c8a99a7230c900ab9ee8cd3d33c1
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
module Scrooge module Middleware class Tracker < Scrooge::Base class << self # Around Filter compatible implementation for Rails as Dispatcher is # the root Rack application and as such don't provide access to the Rails # Routing internals from other middleware. # def filter( controller ) Scrooge::Base.profile.tracker.track( Thread.scrooge_resource ) do begin Scrooge::Base.profile.framework.resource( {}, controller.request ) yield ensure Thread.reset_scrooge_resource! end end end end def initialize(app, options = {}) @app = app end # Assign a default Resource Tracker instance to Thread.current[:scrooge_resource] # and supplement it with request specific details ( format, action && controller ) # after yielding to the app.Flush Thread.current[:scrooge_resource] on completion. # def call(env) Scrooge::Base.profile.tracker.track( Thread.scrooge_resource ) do begin result = @app.call(env) Scrooge::Base.profile.framework.resource( env ) result ensure Thread.reset_scrooge_resource! end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
methodmissing-scrooge-1.0.4 | lib/scrooge/middleware/tracker.rb |