Class: Postnhost::Constraints::PublicRouteConstraint
- Inherits:
-
Object
- Object
- Postnhost::Constraints::PublicRouteConstraint
- Defined in:
- app/services/postnhost/constraints/public_route_constraint.rb
Instance Method Summary collapse
-
#initialize(kind:, parameter:) ⇒ PublicRouteConstraint
constructor
A new instance of PublicRouteConstraint.
- #matches?(request) ⇒ Boolean
Constructor Details
#initialize(kind:, parameter:) ⇒ PublicRouteConstraint
Returns a new instance of PublicRouteConstraint.
4 5 6 7 |
# File 'app/services/postnhost/constraints/public_route_constraint.rb', line 4 def initialize(kind:, parameter:) @kind = kind @parameter = parameter end |
Instance Method Details
#matches?(request) ⇒ Boolean
9 10 11 12 |
# File 'app/services/postnhost/constraints/public_route_constraint.rb', line 9 def matches?(request) slug = request.params.fetch(parameter) Postnhost::PublicRequestContext.for(request).resolve_kind(kind, slug).present? end |