Class: RailsApiGuard::Services::ExclusionChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_api_guard/services/exclusion_checker.rb

Class Method Summary collapse

Class Method Details

.excluded_endpoint?(path) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rails_api_guard/services/exclusion_checker.rb', line 4

def self.excluded_endpoint?(path)
    return true if path.start_with?('/.well-known')

    RailsApiGuard.config.excluded_patterns.any? do |pattern|
        if pattern.start_with?("^")
            Regexp.new(pattern).match?(path)
        else
            File.fnmatch?(pattern, path)
        end
    end
end