Class: ActionController::Session::AbstractStore::SessionHash
- Defined in:
- lib/action_controller/session/abstract_store.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #clear ⇒ Object
- #data ⇒ Object
- #delete(key) ⇒ Object
- #destroy ⇒ Object
- #exists? ⇒ Boolean
- #has_key?(key) ⇒ Boolean
-
#initialize(by, env) ⇒ SessionHash
constructor
A new instance of SessionHash.
- #inspect ⇒ Object
- #loaded? ⇒ Boolean
- #session_id ⇒ Object
- #to_hash ⇒ Object
- #update(hash) ⇒ Object
Constructor Details
#initialize(by, env) ⇒ SessionHash
Returns a new instance of SessionHash.
42 43 44 45 46 47 |
# File 'lib/action_controller/session/abstract_store.rb', line 42 def initialize(by, env) super() @by = by @env = env @loaded = false end |
Instance Method Details
#[](key) ⇒ Object
56 57 58 59 |
# File 'lib/action_controller/session/abstract_store.rb', line 56 def [](key) load_for_read! super end |
#[]=(key, value) ⇒ Object
66 67 68 69 |
# File 'lib/action_controller/session/abstract_store.rb', line 66 def []=(key, value) load_for_write! super end |
#clear ⇒ Object
71 72 73 74 |
# File 'lib/action_controller/session/abstract_store.rb', line 71 def clear load_for_write! super end |
#data ⇒ Object
93 94 95 96 97 98 |
# File 'lib/action_controller/session/abstract_store.rb', line 93 def data ActiveSupport::Deprecation.warn( "ActionController::Session::AbstractStore::SessionHash#data " + "has been deprecated. Please use #to_hash instead.", caller) to_hash end |
#delete(key) ⇒ Object
88 89 90 91 |
# File 'lib/action_controller/session/abstract_store.rb', line 88 def delete(key) load_for_write! super end |
#destroy ⇒ Object
114 115 116 117 118 119 |
# File 'lib/action_controller/session/abstract_store.rb', line 114 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 |
#exists? ⇒ Boolean
105 106 107 108 |
# File 'lib/action_controller/session/abstract_store.rb', line 105 def exists? return @exists if instance_variable_defined?(:@exists) @exists = @by.send(:exists?, @env) end |
#has_key?(key) ⇒ Boolean
61 62 63 64 |
# File 'lib/action_controller/session/abstract_store.rb', line 61 def has_key?(key) load_for_read! super end |
#inspect ⇒ Object
100 101 102 103 |
# File 'lib/action_controller/session/abstract_store.rb', line 100 def inspect load_for_read! super end |
#loaded? ⇒ Boolean
110 111 112 |
# File 'lib/action_controller/session/abstract_store.rb', line 110 def loaded? @loaded end |
#session_id ⇒ Object
49 50 51 52 53 54 |
# File 'lib/action_controller/session/abstract_store.rb', line 49 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_hash ⇒ Object
76 77 78 79 80 81 |
# File 'lib/action_controller/session/abstract_store.rb', line 76 def to_hash load_for_read! h = {}.replace(self) h.delete_if { |k,v| v.nil? } h end |
#update(hash) ⇒ Object
83 84 85 86 |
# File 'lib/action_controller/session/abstract_store.rb', line 83 def update(hash) load_for_write! super end |