Class: Tyrant::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/tyrant/session.rb

Overview

HTTP/Warden session-specific behavior.

Instance Method Summary collapse

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_userObject



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

Returns:

  • (Boolean)


12
13
14
# File 'lib/tyrant/session.rb', line 12

def signed_in?
  @warden.user
end