Sha256: 436a1b3f055a0199acb632887d1fe5b5e382e8d52585ff16001a7514a69c87f8

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

  module RedisAnalytics
    class Filter
      attr_reader :filter_proc

      def initialize(filter_proc)
        @filter_proc = filter_proc
      end

      def matches?(request, response)
        filter_proc.call(request, response)
      end

    end

    class PathFilter
      attr_reader :filter_path

      def initialize(filter_path)
        @filter_path = filter_path
      end

      def matches?(request_path)
        if filter_path.is_a?(String)
          request_path == filter_path
        elsif filter_path.is_a?(Regexp)
          request_path =~ filter_path
        end
      end
    end

  end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis_analytics-0.7.1 lib/redis_analytics/filter.rb