Class: Tyrant::Session
- Inherits:
-
Object
- Object
- Tyrant::Session
- Defined in:
- lib/tyrant/session.rb
Overview
HTTP/Warden session-specific behavior.
Instance Method Summary collapse
- #current_user ⇒ Object
-
#initialize(warden) ⇒ Session
constructor
A new instance of Session.
- #sign_in!(user) ⇒ Object
- #sign_out! ⇒ Object
- #signed_in? ⇒ Boolean
Constructor Details
#initialize(warden) ⇒ Session
Returns a new instance of Session.
4 5 6 |
# File 'lib/tyrant/session.rb', line 4 def initialize(warden) @warden = warden end |
Instance Method Details
#current_user ⇒ Object
8 9 10 |
# File 'lib/tyrant/session.rb', line 8 def current_user @warden.user end |
#sign_in!(user) ⇒ Object
16 17 18 |
# File 'lib/tyrant/session.rb', line 16 def sign_in!(user) @warden.set_user(user) end |
#sign_out! ⇒ Object
20 21 22 |
# File 'lib/tyrant/session.rb', line 20 def sign_out! @warden.logout end |
#signed_in? ⇒ Boolean
12 13 14 |
# File 'lib/tyrant/session.rb', line 12 def signed_in? @warden.user end |