Class: Thredded::FriendlyIdReservedWordsAndPagination
- Inherits:
-
Object
- Object
- Thredded::FriendlyIdReservedWordsAndPagination
- Defined in:
- app/models/concerns/thredded/friendly_id_reserved_words_and_pagination.rb
Overview
Excludes pagination routes in addition to the given list of reserved words.
Constant Summary collapse
- PAGINATION_PATTERN =
/\Apage-\d+\z/i
Instance Method Summary collapse
- #include?(slug) ⇒ Boolean
-
#initialize(words = []) ⇒ FriendlyIdReservedWordsAndPagination
constructor
A new instance of FriendlyIdReservedWordsAndPagination.
Constructor Details
#initialize(words = []) ⇒ FriendlyIdReservedWordsAndPagination
Returns a new instance of FriendlyIdReservedWordsAndPagination.
9 10 11 |
# File 'app/models/concerns/thredded/friendly_id_reserved_words_and_pagination.rb', line 9 def initialize(words = []) @words = Set.new(words) end |
Instance Method Details
#include?(slug) ⇒ Boolean
13 14 15 |
# File 'app/models/concerns/thredded/friendly_id_reserved_words_and_pagination.rb', line 13 def include?(slug) @words.include?(slug) || PAGINATION_PATTERN.match?(slug) end |