Class: CurrentSession::Base
- Inherits:
-
ActiveSupport::CurrentAttributes
- Object
- ActiveSupport::CurrentAttributes
- CurrentSession::Base
- Includes:
- Interface
- Defined in:
- lib/current_session/base.rb
Overview
Base class for implementing current_user
Class Attribute Summary collapse
-
.session_token_class ⇒ Object
Returns the value of attribute session_token_class.
-
.user_class ⇒ Object
Returns the value of attribute user_class.
Class Method Summary collapse
- .auth_methods(&block) ⇒ Object
- .auth_methods=(auth_methods_module) ⇒ Object
- .current_time(_) ⇒ Object
- .session_methods(&block) ⇒ Object
- .session_methods=(session_methods) ⇒ Object
Class Attribute Details
.session_token_class ⇒ Object
Returns the value of attribute session_token_class.
12 13 14 |
# File 'lib/current_session/base.rb', line 12 def session_token_class @session_token_class end |
.user_class ⇒ Object
Returns the value of attribute user_class.
13 14 15 |
# File 'lib/current_session/base.rb', line 13 def user_class @user_class end |
Class Method Details
.auth_methods(&block) ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/current_session/base.rb', line 42 def auth_methods(&block) if block @auth_methods = Module.new(&block) @auth_class = CurrentSession::AuthMethod.new_auth_class(auth_methods) @auth_class.user_class = user_class else @auth_methods end end |
.auth_methods=(auth_methods_module) ⇒ Object
38 39 40 |
# File 'lib/current_session/base.rb', line 38 def auth_methods=(auth_methods_module) @auth_class = CurrentSession::AuthMethod.new_auth_class(auth_methods_module) end |
.current_time(_) ⇒ Object
20 21 22 |
# File 'lib/current_session/base.rb', line 20 def current_time(_) Time.current end |
.session_methods(&block) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/current_session/base.rb', line 29 def session_methods(&block) if block @session_methods = Module.new(&block) @session_class = CurrentSession::SessionMethod.new_session_class(session_methods) else @session_methods end end |
.session_methods=(session_methods) ⇒ Object
24 25 26 27 |
# File 'lib/current_session/base.rb', line 24 def session_methods=(session_methods) @session_methods = session_methods @session_class = CurrentSession::SessionMethod.new_session_class(session_methods) end |