Sha256: 94e4a1f6fca667ddd14e2ee04ae1051c8aaeb9ad79fc303f63ff392ab035cc21

Contents?: true

Size: 700 Bytes

Versions: 4

Compression:

Stored size: 700 Bytes

Contents

module Rack; module Throttle
  ###
  # This is the base class for matcher implementations.
  # Implementations are provided for User Agent, URL, and request
  # method. Subclass Matcher if you want to provide a custom
  # implementation.
  class Matcher
    attr_reader :rule

    def initialize(rule)
      @rule = rule
    end

    # Must be implemented in a subclass.
    # MUST return true or false.
    # @return [Boolean]
    # @abstract
    def match?
      true
    end

    # Must be implemented in a subclass.
    # Used to produce a unique key in our cache store.
    # Typically of the form "xx-"
    # @return [String]
    # @abstract
    def identifier
      ""
    end
  end

end; end

Version data entries

4 entries across 4 versions & 2 rubygems

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