Class: Sitepress::RouteConstraint

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

Overview

Route constraint for rails routes.rb file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site: Sitepress.site) ⇒ RouteConstraint

Returns a new instance of RouteConstraint.



6
7
8
# File 'lib/sitepress/route_constraint.rb', line 6

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

Instance Attribute Details

#siteObject (readonly)

Returns the value of attribute site.



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

def site
  @site
end

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/sitepress/route_constraint.rb', line 10

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