Class: Sitepress::RouteConstraint

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

Overview

Route constraint for rails routes.rb file.

Instance Method Summary collapse

Constructor Details

#initialize(site: Sitepress.site) ⇒ RouteConstraint

Returns a new instance of RouteConstraint.


4
5
6
# File 'lib/sitepress/route_constraint.rb', line 4

def initialize(site: Sitepress.site)
  @site = site
end

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)

8
9
10
# File 'lib/sitepress/route_constraint.rb', line 8

def matches?(request)
  !!@site.resources.get(request.path)
end