Class: Mintaka::Constraints::RootRoute

Inherits:
Object
  • Object
show all
Defined in:
lib/mintaka/constraints/root_route.rb

Overview

Routing constraint to validate request.path has a corresponding view

Class Method Summary collapse

Class Method Details

.matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
# File 'lib/mintaka/constraints/root_route.rb', line 6

def matches?(request)
  page_id = clean_page_path(request.path)
  pattern = file_pattern(page_id)

  Dir.glob(pattern).any?
end