Class: SqAuth::SqAuthSessions
- Inherits:
-
Object
- Object
- SqAuth::SqAuthSessions
- Defined in:
- lib/sq_auth/sq_auth_sessions.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #delete_session(session) ⇒ Object
-
#initialize ⇒ SqAuthSessions
constructor
A new instance of SqAuthSessions.
Constructor Details
#initialize ⇒ SqAuthSessions
Returns a new instance of SqAuthSessions.
3 4 5 6 |
# File 'lib/sq_auth/sq_auth_sessions.rb', line 3 def initialize @sessions = {} @known_sessions = {} end |
Instance Method Details
#[](key) ⇒ Object
8 9 10 |
# File 'lib/sq_auth/sq_auth_sessions.rb', line 8 def [] key @sessions[key] end |
#[]=(key, value) ⇒ Object
12 13 14 15 |
# File 'lib/sq_auth/sq_auth_sessions.rb', line 12 def []= key, value @known_sessions[value] ||= SqAuthSession.new(value) @sessions[key] = @known_sessions[value] end |
#delete_session(session) ⇒ Object
17 18 19 |
# File 'lib/sq_auth/sq_auth_sessions.rb', line 17 def delete_session session @known_sessions.delete(session) end |