Sha256: 0545bd18d0e314fd099d4ff8723d2787cad8f6bb12e685eb263433b06dda7dbb
Contents?: true
Size: 980 Bytes
Versions: 1
Compression:
Stored size: 980 Bytes
Contents
module Timber module Probes class Rack < Probe class Middleware def initialize(app) @app = app end def call(env) context = Contexts::HTTPRequests::Rack.new(env) CurrentContext.add(context) do @app.call(env) end end end attr_reader :middleware, :insert_before def initialize(middleware, insert_before) if middleware.nil? raise RequirementNotMetError.new("The middleware class attribute is not set. " + "We need a middleware to insert the probe.") end @middleware = middleware @insert_before = insert_before end def insert! return true if middleware.instance_variable_get(:"@_timber_inserted") == true # Rails uses a proxy :/ middleware.instance_variable_set(:"@_timber_inserted", true) middleware.insert_before insert_before, Middleware end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timberio-1.0.0.beta1 | lib/timber/probes/rack.rb |