Sha256: a83ffe6e8278d42fecdac4a099a9e3eae1005556f0e331a14d6582867518da65

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 matcha gainst 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 & 2 rubygems

Version Path
improved-rack-throttle-w-expiry-0.8.0 lib/rack/throttle/matchers/url_matcher.rb
improved-rack-throttle-0.7.1 lib/rack/throttle/matchers/url_matcher.rb