class BasicAuth::Matcher
Public Class Methods
new(path, options={})
click to toggle source
# File lib/basic_auth/matcher.rb, line 3 def initialize(path, options={}) @path, @options = path, options @protect = options[:protect] end
Public Instance Methods
match?()
click to toggle source
# File lib/basic_auth/matcher.rb, line 8 def match? return true unless @protect # defaults to protect all # If user accidentally sets a string, change to a regexp pattern = @protect.is_a?(String) ? Regexp.new(@protect) : @protect matched = @path =~ pattern !!matched end