Class: ActionDispatch::Session::AbstractStore::SessionHash
- Inherits:
-
Hash
- Object
- Hash
- ActionDispatch::Session::AbstractStore::SessionHash
show all
- Defined in:
- actionpack/lib/action_dispatch/middleware/session/abstract_store.rb
Instance Method Summary
(collapse)
Methods inherited from Hash
#as_json, #assert_valid_keys, #deep_merge, #deep_merge!, #diff, #encode_json, #except, #except!, #extract!, #extractable_options?, from_xml, #reverse_merge, #reverse_merge!, #slice, #slice!, #stringify_keys, #stringify_keys!, #symbolize_keys, #symbolize_keys!, #to_param, #to_xml, #with_indifferent_access
Constructor Details
- (SessionHash) initialize(by, env)
A new instance of SessionHash
45
46
47
48
49
50
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 45
def initialize(by, env)
super()
@by = by
@env = env
@loaded = false
end
|
Instance Method Details
52
53
54
55
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 52
def [](key)
load_for_read!
super(key.to_s)
end
|
- (Object) []=(key, value)
62
63
64
65
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 62
def []=(key, value)
load_for_write!
super(key.to_s, value)
end
|
67
68
69
70
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 67
def clear
load_for_write!
super
end
|
- (Object) delete(key)
84
85
86
87
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 84
def delete(key)
load_for_write!
super(key.to_s)
end
|
103
104
105
106
107
108
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 103
def destroy
clear
@by.send(:destroy, @env) if @by
@env[ENV_SESSION_OPTIONS_KEY][:id] = nil if @env && @env[ENV_SESSION_OPTIONS_KEY]
@loaded = false
end
|
- (Boolean) exists?
94
95
96
97
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 94
def exists?
return @exists if instance_variable_defined?(:@exists)
@exists = @by.send(:exists?, @env)
end
|
- (Boolean) has_key?(key)
57
58
59
60
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 57
def has_key?(key)
load_for_read!
super(key.to_s)
end
|
89
90
91
92
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 89
def inspect
load_for_read!
super
end
|
- (Boolean) loaded?
99
100
101
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 99
def loaded?
@loaded
end
|
72
73
74
75
76
77
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 72
def to_hash
load_for_read!
h = {}.replace(self)
h.delete_if { |k,v| v.nil? }
h
end
|
- (Object) update(hash)
79
80
81
82
|
# File 'actionpack/lib/action_dispatch/middleware/session/abstract_store.rb', line 79
def update(hash)
load_for_write!
super(hash.stringify_keys)
end
|