Class: Maveric::Sessions
- Inherits:
-
Set
- Object
- Set
- Maveric::Sessions
- Defined in:
- lib/maveric/sessions.rb
Overview
Contains session data and provides conveniance in generating an appropriate cookie.
Defined Under Namespace
Classes: Session
Constant Summary collapse
- COOKIE_NAME =
'SESSIONID'
Instance Method Summary collapse
-
#session(id) ⇒ Object
wants stringed hex num.
Instance Method Details
#session(id) ⇒ Object
wants stringed hex num
8 9 10 11 12 13 14 15 16 |
# File 'lib/maveric/sessions.rb', line 8 def session id #wants stringed hex num #ensure crusty old sessions don't linger @__i += 1 rescue @__i = 1 reject!{|s| s.expire < Time.now-3 } if (@__i%=10) == 0 # now get the session session = find{|s| s.id == id } and return session #there isn't one? then make a new one! push Session.new and return last end |