module Merb::SessionMixin
This is mixed into Merb::Controller on framework boot.
Public Class Methods
included(base)
click to toggle source
:api: private
# File lib/merb-core/dispatch/session.rb, line 59 def self.included(base) # Register a callback to finalize sessions - needs to run before the cookie # callback extracts Set-Cookie headers from request.cookies. base._after_dispatch_callbacks.unshift lambda { |c| c.request.finalize_session } end
rand_uuid()
click to toggle source
Returns¶ ↑
- String
-
A random 32 character string for use as a unique session ID.
:api: private
# File lib/merb-core/dispatch/session.rb, line 82 def rand_uuid if defined?(SecureRandom) SecureRandom.hex(16) else values = [ rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x1000000), rand(0x1000000), ] "%04x%04x%04x%04x%04x%06x%06x" % values end end
Public Instance Methods
session(session_store = nil)
click to toggle source
Parameters¶ ↑
- session_store<String>
-
The type of session store to access.
Returns¶ ↑
- SessionContainer
-
The session that was extracted from the request object.
:api: public
# File lib/merb-core/dispatch/session.rb, line 72 def session(session_store = nil) request.session(session_store) end
Private Instance Methods
rand_uuid()
click to toggle source
Returns¶ ↑
- String
-
A random 32 character string for use as a unique session ID.
:api: private
# File lib/merb-core/dispatch/session.rb, line 82 def rand_uuid if defined?(SecureRandom) SecureRandom.hex(16) else values = [ rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x0010000), rand(0x1000000), rand(0x1000000), ] "%04x%04x%04x%04x%04x%06x%06x" % values end end