Class: Sessions
Instance Method Summary collapse
- #[](sessionid) ⇒ Object
- #[]=(sessionid, value) ⇒ Object
- #delete(sessionid) ⇒ Object
- #delete_if(&block) ⇒ Object
- #include?(sessionid) ⇒ Boolean
-
#initialize(rack, cleanup) ⇒ Sessions
constructor
A new instance of Sessions.
Constructor Details
#initialize(rack, cleanup) ⇒ Sessions
Returns a new instance of Sessions.
1111 1112 1113 1114 1115 |
# File 'lib/rwd/rwd.rb', line 1111 def initialize(rack, cleanup) @rack = rack.to_s @cleanup = SessionCleanup.new(self, 3600, 24*3600) if cleanup @sessions = {} end |
Instance Method Details
#[](sessionid) ⇒ Object
1117 1118 1119 |
# File 'lib/rwd/rwd.rb', line 1117 def [](sessionid) @sessions[sessionid] end |
#[]=(sessionid, value) ⇒ Object
1121 1122 1123 |
# File 'lib/rwd/rwd.rb', line 1121 def []=(sessionid, value) @sessions[sessionid] = value end |
#delete(sessionid) ⇒ Object
1125 1126 1127 |
# File 'lib/rwd/rwd.rb', line 1125 def delete(sessionid) @sessions.delete(sessionid) end |
#delete_if(&block) ⇒ Object
1129 1130 1131 |
# File 'lib/rwd/rwd.rb', line 1129 def delete_if(&block) @sessions.delete_if{|k, v| block.call(k, v)} end |
#include?(sessionid) ⇒ Boolean
1133 1134 1135 |
# File 'lib/rwd/rwd.rb', line 1133 def include?(sessionid) @sessions.include?(sessionid) end |