Class: Clearance::Constraints::SignedIn

Inherits:
Object
  • Object
show all
Defined in:
lib/clearance/constraints/signed_in.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ SignedIn

Returns a new instance of SignedIn



4
5
6
# File 'lib/clearance/constraints/signed_in.rb', line 4

def initialize(&block)
  @block = block || lambda { |user| true }
end

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/clearance/constraints/signed_in.rb', line 8

def matches?(request)
  @request = request
  signed_in? && current_user_fulfills_additional_requirements?
end