Sha256: 139b5c84fcb55a2c16635db91fd0d1552c65866699531e3fc6e709d3ff6dec95
Contents?: true
Size: 719 Bytes
Versions: 6
Compression:
Stored size: 719 Bytes
Contents
# frozen_string_literal: true module BreezyPDFLite # Intercept a Rack request class Interceptor attr_reader :app, :env def initialize(app, env) @app = app @env = env end def intercept! if intercept? intercept.new(@app, @env).call else app.call(env) end end private def intercept? get? && matching_uri? end def matching_uri? matchers.any? { |regex| env["REQUEST_URI"].match?(regex) } end def get? env["REQUEST_METHOD"].match?(/get/i) end def matchers @matchers ||= BreezyPDFLite.middleware_path_matchers end def intercept BreezyPDFLite::Intercept::HTML end end end
Version data entries
6 entries across 6 versions & 1 rubygems