class BonaFide::Constraint
Public Class Methods
new(getter)
click to toggle source
Sets up a constraint for use with ActionDispatch::Routing
. Pass in a method, getter
, to be called on the specified base_class
for the current BonaFide
session.
# File lib/bona_fide/constraint.rb, line 6 def initialize(getter) @getter = getter end
Public Instance Methods
matches?(request)
click to toggle source
Called from ActionDispatch::Routing
, calls the requested getter
method on the BonaFide::Configuration
base_class
. The response should be either true
or false
.
# File lib/bona_fide/constraint.rb, line 13 def matches?(request) BonaFide.config.base_class.send(@getter) end