Sha256: cb16af149bc83e2e5309ad3b216f63a59029d9644a619e23f8776ebcdbb0a163

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 Bytes

Contents

module Workarea
  module BasicAuth
    class SimpleRouteSet
      attr_reader :paths

      def initialize
        @paths = []
      end

      def add(path_string, *http_methods)
        paths.push(Path.new(path_string, *http_methods))
      end

      def remove(path_string)
        @paths = paths.reject { |path| path.matches?(path_string) }
      end

      def matches?(request)
        paths.detect { |path| path.matches?(request) }.present?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-basic_auth-1.1.2 lib/workarea/basic_auth/simple_route_set.rb
workarea-basic_auth-1.1.1 lib/workarea/basic_auth/simple_route_set.rb