Class: BonaFide::Constraint
- Inherits:
-
Object
- Object
- BonaFide::Constraint
- Defined in:
- lib/bona_fide/constraint.rb
Instance Method Summary collapse
-
#initialize(getter) ⇒ Constraint
constructor
Sets up a constraint for use with
ActionDispatch::Routing
. -
#matches?(request) ⇒ Boolean
Called from
ActionDispatch::Routing
, calls the requestedgetter
method on theBonaFide::Configuration
base_class
.
Constructor Details
#initialize(getter) ⇒ Constraint
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.
6 7 8 |
# File 'lib/bona_fide/constraint.rb', line 6 def initialize(getter) @getter = getter end |
Instance Method Details
#matches?(request) ⇒ Boolean
Called from ActionDispatch::Routing
, calls the requested getter
method on the BonaFide::Configuration
base_class
. The response should be either true
or false
.
13 14 15 |
# File 'lib/bona_fide/constraint.rb', line 13 def matches?(request) BonaFide.config.base_class.send(@getter) end |