Class Index [+]

Quicksearch

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
59:     def self.included(base)
60:       # Register a callback to finalize sessions - needs to run before the cookie
61:       # callback extracts Set-Cookie headers from request.cookies.
62:       base._after_dispatch_callbacks.unshift lambda { |c| c.request.finalize_session }
63:     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
82:     def rand_uuid
83:       if defined?(SecureRandom)
84:         SecureRandom.hex(16)
85:       else
86:         values = [
87:           rand(0x0010000),
88:           rand(0x0010000),
89:           rand(0x0010000),
90:           rand(0x0010000),
91:           rand(0x0010000),
92:           rand(0x1000000),
93:           rand(0x1000000),
94:         ]
95:         "%04x%04x%04x%04x%04x%06x%06x" % values
96:       end
97:     end

Public Instance Methods

session(session_store = nil) click to toggle source

Parameters

session_store

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
72:     def session(session_store = nil)
73:       request.session(session_store)
74:     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
82:     def rand_uuid
83:       if defined?(SecureRandom)
84:         SecureRandom.hex(16)
85:       else
86:         values = [
87:           rand(0x0010000),
88:           rand(0x0010000),
89:           rand(0x0010000),
90:           rand(0x0010000),
91:           rand(0x0010000),
92:           rand(0x1000000),
93:           rand(0x1000000),
94:         ]
95:         "%04x%04x%04x%04x%04x%06x%06x" % values
96:       end
97:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.