Sha256: 19cc62344125d29f461127798462f4b042fedafd07884f6ac7d692aa6099c252
Contents?: true
Size: 594 Bytes
Versions: 2
Compression:
Stored size: 594 Bytes
Contents
module Rack; module Throttle ### # UrlMatchers are used to restrict requests based on the URL # requested. For instance, you may care about limiting requests # to a machine-consumed API, but not be concerned about requests # coming from browsers. # UrlMatchers take Regexp object to match against the request path. class UrlMatcher < Matcher ### # @param [Rack::Request] request # @return [Boolean] def match?(request) !!(@rule =~ request.path) end ### # @return [String] def identifier "url-" + @rule.inspect end end end; end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
improved-rack-throttle-0.9.0 | lib/rack/throttle/matchers/url_matcher.rb |
improved-rack-throttle-0.8.0 | lib/rack/throttle/matchers/url_matcher.rb |