Class: HighVoltage::Constraints::RootRoute

Inherits:
Object
  • Object
show all
Defined in:
lib/high_voltage/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)


5
6
7
8
9
# File 'lib/high_voltage/constraints/root_route.rb', line 5

def self.matches?(request)
  pattern = file_pattern(request.path)

  Dir.glob(pattern).any?
end