Sha256: 8eac7407b643ebc1943eb4283aa4e1480bddbd9534debaca787aefb43c92eed9
Contents?: true
Size: 696 Bytes
Versions: 12
Compression:
Stored size: 696 Bytes
Contents
module Stitches # A middleware that will skip its behavior if the path matches a white-listed URL class WhitelistingMiddleware def initialize(app, options={}) @app = app @configuration = options[:configuration] || Stitches.configuration @except = options[:except] || @configuration.whitelist_regexp unless @except.nil? || @except.is_a?(Regexp) raise ":except must be a Regexp" end end def call(env) if @except && @except.match(env["PATH_INFO"]) @app.call(env) else do_call(env) end end protected def do_call(env) raise 'subclass must implement' end end end
Version data entries
12 entries across 12 versions & 1 rubygems