<commit_before>require 'rack_dav/interceptor_resource'
module RackDAV
  class Interceptor
    def initialize(app, args={})
      @roots = args[:mappings].keys
      @args = args
      @app = app
    end
    
    def call(env)
      path = env['REQUEST_PATH'].downcase
      method = env['REQUEST_METHOD']
      if(@roots.detect{|x| path =~ /^#{Regexp.escape(x.downcase)}\/?/}.nil? && ['OPTIONS', 'PROPFIND'].include?(method))
        @app = RackDAV::Handler.new(:resource_class => InterceptorResource, :mappings => @args[:mappings])
      end
      @app.call(env)
    end
  end
end<commit_msg>Keep the interceptor temporary<commit_after>require 'rack_dav/interceptor_resource'
module RackDAV
  class Interceptor
    def initialize(app, args={})
      @roots = args[:mappings].keys
      @args = args
      @app = app
    end
    
    def call(env)
      path = env['REQUEST_PATH'].downcase
      method = env['REQUEST_METHOD']
      app = nil
      if(@roots.detect{|x| path =~ /^#{Regexp.escape(x.downcase)}\/?/}.nil? && ['OPTIONS', 'PROPFIND'].include?(method))
        puts "Intercepting with method: #{method} for path: #{path}"
        app = RackDAV::Handler.new(:resource_class => InterceptorResource, :mappings => @args[:mappings])
      end
      app ? app.call(env) : @app.call(env)
    end
  end
end
{'fraction_non_alphanumeric': 0.15660809778456838, 'fraction_numerical': 0.0, 'mean_word_length': 3.1455696202531644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3279782', 'n_tokens_mistral': 437, 'n_tokens_neox': 429, 'n_words': 88}