Class: Monban::Constraints::SignedOut

Inherits:
Object
  • Object
show all
Defined in:
lib/monban/constraints/signed_out.rb

Overview

Rails route constraint for signed out users

Since:

  • 0.0.15

Instance Method Summary collapse

Instance Method Details

#matches?(request) ⇒ Boolean

Checks to see if the constraint is matched by not having a user signed in

Parameters:

  • request (Rack::Request)

    A rack request

Returns:

  • (Boolean)

Since:

  • 0.0.15



8
9
10
11
# File 'lib/monban/constraints/signed_out.rb', line 8

def matches?(request)
  warden = request.env["warden"]
  warden && warden.unauthenticated?
end