class Escher::RackMiddleware
Constants
- VERSION
Public Class Methods
new(app, options = {})
click to toggle source
# File lib/escher/rack_middleware.rb, line 19 def initialize(app, options = {}) @app = app @options = options end
Protected Class Methods
config(&block)
click to toggle source
# File lib/escher/rack_middleware.rb, line 41 def self.config(&block) block.call(self) end
Public Instance Methods
call(request_env)
click to toggle source
# File lib/escher/rack_middleware.rb, line 24 def call(request_env) if authorize_path?(::Rack::Utils.clean_path_info(request_env[::Rack::PATH_INFO])) return unauthorized_response unless authorized?(request_env) end @app.call(request_env) end
Protected Instance Methods
final_options()
click to toggle source
# File lib/escher/rack_middleware.rb, line 71 def final_options @final_options ||= default_options.merge(@options) end
paths_of(option_key, h)
click to toggle source
# File lib/escher/rack_middleware.rb, line 60 def paths_of(option_key, h) path = h[:include] final_options[option_key].any? do |matcher| if matcher.is_a?(Regexp) !!(path =~ matcher) else path == matcher.to_s end end end