Module: EasySwaggerUi::RouteMatcher

Defined in:
lib/easy_swagger_ui/route_matcher.rb

Class Method Summary collapse

Class Method Details

.matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
# File 'lib/easy_swagger_ui/route_matcher.rb', line 3

def self.matches?(request)
  return false unless request.params[:doc_path] =~ %r{\A[\w\-/]*\z}
  filepath = File.join(
    EasySwaggerUi.base_path,
    request.params[:doc_path],
    'swagger.yml'
  )
  File.file?(filepath)
end