Class: SessionCleanup
Instance Method Summary collapse
-
#initialize(sessions, interval, timeout) ⇒ SessionCleanup
constructor
A new instance of SessionCleanup.
Constructor Details
#initialize(sessions, interval, timeout) ⇒ SessionCleanup
Returns a new instance of SessionCleanup.
1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 |
# File 'lib/rwd/rwd.rb', line 1132 def initialize(sessions, interval, timeout) every(interval) do sessions.delete_if do |id, session| time = Time.now.to_i - session.lastaccess.to_i puts "Session %s deleted" % id if time > timeout time > timeout end end end |