Class: CGI::Session

Inherits:
Object show all
Defined in:
lib/action_controller/cgi_ext/session.rb,
lib/action_controller/session/drb_store.rb,
lib/action_controller/session/active_record_store.rb

Overview

  • Expose the CGI instance to session stores.

  • Don’t require ‘digest/md5’ whenever a new session id is generated.

Defined Under Namespace

Classes: ActiveRecordStore, CookieStore, DRbStore, PStore

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cgi, options = {}) ⇒ Session

Returns a new instance of Session.



17
18
19
20
# File 'lib/action_controller/cgi_ext/session.rb', line 17

def initialize(cgi, options = {})
  @cgi = cgi
  initialize_without_cgi_reader(cgi, options)
end

Instance Attribute Details

#cgiObject (readonly)

Make the CGI instance available to session stores.



14
15
16
# File 'lib/action_controller/cgi_ext/session.rb', line 14

def cgi
  @cgi
end

#dataObject (readonly)

Returns the value of attribute data.



7
8
9
# File 'lib/action_controller/session/active_record_store.rb', line 7

def data
  @data
end

#dbmanObject (readonly)

Returns the value of attribute dbman.



15
16
17
# File 'lib/action_controller/cgi_ext/session.rb', line 15

def dbman
  @dbman
end

Class Method Details

.generate_unique_id(constant = nil) ⇒ Object

:nodoc:



9
10
11
# File 'lib/action_controller/cgi_ext/session.rb', line 9

def self.generate_unique_id(constant = nil)
  ActiveSupport::SecureRandom.hex(16)
end

Instance Method Details

#initialize_without_cgi_readerObject



16
# File 'lib/action_controller/cgi_ext/session.rb', line 16

alias_method :initialize_without_cgi_reader, :initialize

#modelObject

Return this session’s underlying Session instance. Useful for the DB-backed session stores.



10
11
12
# File 'lib/action_controller/session/active_record_store.rb', line 10

def model
  @dbman.model if @dbman
end