Class: Brightcontent::Pages::PathConstraint

Inherits:
Object
  • Object
show all
Defined in:
lib/brightcontent/pages/path_constraint.rb

Constant Summary collapse

CACHE_KEY =
:brightcontent_page_slugs

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.expireObject



6
7
8
# File 'lib/brightcontent/pages/path_constraint.rb', line 6

def self.expire
  Rails.cache.delete(CACHE_KEY)
end

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/brightcontent/pages/path_constraint.rb', line 10

def matches?(request)
  slug = Brightcontent.page_model.sanitize_path(request.path)
  cached_page_slugs.include?(slug)
end