Class: Skyline::RouteConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/skyline/route_constraint.rb

Class Method Summary collapse

Class Method Details

.matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
13
# File 'lib/skyline/route_constraint.rb', line 3

def matches?(request)
  is_skyline_path = false
  
  # Exclude /[skyline_prefix]/*
  is_skyline_path ||= (request.fullpath =~ /^\/?#{Regexp.escape(Skyline::Configuration.url_prefix)}/)
  
  # Also exclude /media/dirs
  is_skyline_path ||= (request.fullpath =~ /^\/?media\/dirs/)
  
  !is_skyline_path
end