Class: Async::Background::Web::Auth
- Inherits:
-
Object
- Object
- Async::Background::Web::Auth
- Defined in:
- lib/async/background/web/auth.rb
Instance Method Summary collapse
- #authorized?(env) ⇒ Boolean
-
#initialize(callable, logger: nil) ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize(callable, logger: nil) ⇒ Auth
Returns a new instance of Auth.
7 8 9 10 |
# File 'lib/async/background/web/auth.rb', line 7 def initialize(callable, logger: nil) @callable = callable @logger = logger end |
Instance Method Details
#authorized?(env) ⇒ Boolean
12 13 14 15 16 17 18 19 20 |
# File 'lib/async/background/web/auth.rb', line 12 def (env) !!@callable.call(env) rescue StandardError => error @logger&.warn( "[async-background-web] auth callable raised: " \ "#{error.class}: #{error.}" ) false end |