Class: Sessions

Inherits:
Object show all
Defined in:
lib/rwd/rwd.rb

Instance Method Summary collapse

Constructor Details

#initialize(rack, cleanup) ⇒ Sessions

Returns a new instance of Sessions.



1146
1147
1148
1149
1150
# File 'lib/rwd/rwd.rb', line 1146

def initialize(rack, cleanup)
  @rack	= rack.to_s
  @cleanup	= SessionCleanup.new(self, 3600, 24*3600)	if cleanup
  @sessions	= {}
end

Instance Method Details

#[](sessionid) ⇒ Object



1152
1153
1154
# File 'lib/rwd/rwd.rb', line 1152

def [](sessionid)
  @sessions[sessionid]
end

#[]=(sessionid, value) ⇒ Object



1156
1157
1158
# File 'lib/rwd/rwd.rb', line 1156

def []=(sessionid, value)
  @sessions[sessionid]	= value
end

#delete(sessionid) ⇒ Object



1160
1161
1162
# File 'lib/rwd/rwd.rb', line 1160

def delete(sessionid)
  @sessions.delete(sessionid)
end

#delete_if(&block) ⇒ Object



1164
1165
1166
# File 'lib/rwd/rwd.rb', line 1164

def delete_if(&block)
  @sessions.delete_if{|k, v| block.call(k, v)}
end

#include?(sessionid) ⇒ Boolean

Returns:

  • (Boolean)


1168
1169
1170
# File 'lib/rwd/rwd.rb', line 1168

def include?(sessionid)
  @sessions.include?(sessionid)
end