Class: ActionController::Session::AbstractStore::SessionHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/action_controller/session/abstract_store.rb

Instance Method Summary collapse

Constructor Details

#initialize(by, env) ⇒ SessionHash

Returns a new instance of SessionHash.



13
14
15
16
17
18
# File 'lib/action_controller/session/abstract_store.rb', line 13

def initialize(by, env)
  super()
  @by = by
  @env = env
  @loaded = false
end

Instance Method Details

#[](key) ⇒ Object



27
28
29
30
# File 'lib/action_controller/session/abstract_store.rb', line 27

def [](key)
  load! unless @loaded
  super
end

#[]=(key, value) ⇒ Object



32
33
34
35
# File 'lib/action_controller/session/abstract_store.rb', line 32

def []=(key, value)
  load! unless @loaded
  super
end

#dataObject



43
44
45
46
47
48
# File 'lib/action_controller/session/abstract_store.rb', line 43

def data
 ActiveSupport::Deprecation.warn(
   "ActionController::Session::AbstractStore::SessionHash#data " +
   "has been deprecated. Please use #to_hash instead.", caller)
  to_hash
end

#inspectObject



50
51
52
53
# File 'lib/action_controller/session/abstract_store.rb', line 50

def inspect
  load! unless @loaded
  super
end

#session_idObject



20
21
22
23
24
25
# File 'lib/action_controller/session/abstract_store.rb', line 20

def session_id
  ActiveSupport::Deprecation.warn(
    "ActionController::Session::AbstractStore::SessionHash#session_id " +
    "has been deprecated. Please use request.session_options[:id] instead.", caller)
  @env[ENV_SESSION_OPTIONS_KEY][:id]
end

#to_hashObject



37
38
39
40
41
# File 'lib/action_controller/session/abstract_store.rb', line 37

def to_hash
  h = {}.replace(self)
  h.delete_if { |k,v| v.nil? }
  h
end