Class: Passwordless::ConstraintNot

Inherits:
Constraint show all
Defined in:
lib/passwordless/constraint.rb

Overview

A class the constraint routes to NOT authenticated records

Instance Attribute Summary

Attributes inherited from Constraint

#authenticatable_type, #predicate, #session

Instance Method Summary collapse

Methods included from ControllerHelpers

#authenticate_by_session, #build_passwordless_session, #create_passwordless_session, #create_passwordless_session!, #find_passwordless_session_for, #redirect_session_key, #reset_passwordless_redirect_location!, #save_passwordless_redirect_location!, #session_key, #sign_in, #sign_out

Constructor Details

#initialize(authenticatable_type, **options) ⇒ ConstraintNot

Returns a new instance of ConstraintNot.

Parameters:

  • authenticatable_type (Class)

    Authenticatable class

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :if (Proc)

    A lambda that takes an authenticatable and returns a boolean



32
33
34
# File 'lib/passwordless/constraint.rb', line 32

def initialize(authenticatable_type, **options)
  super
end

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/passwordless/constraint.rb', line 36

def matches?(request)
  !super
end