Sha256: b6533bf463698373f976f60e45f75266f6a12654ab6f26f7aa740c6054e46cb3
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
class Lecter::Rack def initialize(app) @app = app end def call(env) request = Rack::Request.new(env) if request.params['lecter_analysis'] thread = Thread.current thread[:items] = '' tp = TracePoint.new(:line, :class, :call, :c_call, :return) do |tp| if tp.path && !tp.path.include?('/app/views') && !tp.path.include?('/app/helpers') && tp.path.include?(Rails.root.to_s) && tp.method_id != :method_added && tp.defined_class != Module && tp.defined_class != Class && tp.defined_class != String && tp.defined_class != Kernel && tp.defined_class != NilClass thread[:items] += [tp.path, tp.lineno, tp.defined_class, tp.method_id, tp.event].join(' ') + ';' end end tp.enable ActionController::Base.allow_forgery_protection = false end status, headers, response = @app.call(env) if tp response = [status.to_s + thread[:items]] status = 200 headers = {} end [status, headers, response] ensure if tp tp.disable ActionController::Base.allow_forgery_protection = true end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lecter-0.1.6 | lib/lecter/rack.rb |