Class: Softwear::Auth::Routing
- Inherits:
-
Object
- Object
- Softwear::Auth::Routing
- Defined in:
- lib/softwear/auth/routing.rb
Instance Method Summary collapse
-
#initialize(user_class, pred = nil) ⇒ Routing
constructor
A new instance of Routing.
- #matches?(request) ⇒ Boolean
Constructor Details
#initialize(user_class, pred = nil) ⇒ Routing
Returns a new instance of Routing.
9 10 11 12 |
# File 'lib/softwear/auth/routing.rb', line 9 def initialize(user_class, pred = nil) @user_class = user_class @pred = pred end |
Instance Method Details
#matches?(request) ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/softwear/auth/routing.rb', line 14 def matches?(request) if user = @user_class.auth(request.session[:user_token]) !@pred || @pred.call(user) else false end end |