Class: Waw::Session
- Extended by:
- FullState::OnInstance
- Defined in:
- lib/waw/session.rb
Instance Method Summary collapse
-
#[](name) ⇒ Object
(also: #get)
Returns the value of a given variable.
-
#[]=(name, value) ⇒ Object
(also: #set)
Returns the value of a given variable.
-
#clear ⇒ Object
Clears the session.
-
#has_key?(name) ⇒ Boolean
Checks if a given key exists in the session.
-
#initialize(rack_session) ⇒ Session
constructor
Creates a session instance.
-
#inspect ⇒ Object
Inspects the session.
-
#rack_session ⇒ Object
Returns Rack’s underlying session Hash.
-
#reset(name) ⇒ Object
(also: #delete, #unset)
Resets a given variable whose name is provided.
Methods included from FullState::OnInstance
Constructor Details
#initialize(rack_session) ⇒ Session
Creates a session instance
7 8 9 |
# File 'lib/waw/session.rb', line 7 def initialize(rack_session) @rack_session = rack_session end |
Instance Method Details
#[](name) ⇒ Object Also known as: get
Returns the value of a given variable
27 28 29 |
# File 'lib/waw/session.rb', line 27 def [](name) rack_session[name] end |
#[]=(name, value) ⇒ Object Also known as: set
Returns the value of a given variable
33 34 35 |
# File 'lib/waw/session.rb', line 33 def []=(name, value) rack_session[name] = value end |
#clear ⇒ Object
Clears the session
17 18 19 |
# File 'lib/waw/session.rb', line 17 def clear rack_session.clear end |
#has_key?(name) ⇒ Boolean
Checks if a given key exists in the session
22 23 24 |
# File 'lib/waw/session.rb', line 22 def has_key?(name) rack_session.has_key?(name) end |
#inspect ⇒ Object
Inspects the session
46 47 48 |
# File 'lib/waw/session.rb', line 46 def inspect rack_session.inspect end |
#rack_session ⇒ Object
Returns Rack’s underlying session Hash
12 13 14 |
# File 'lib/waw/session.rb', line 12 def rack_session @rack_session end |
#reset(name) ⇒ Object Also known as: delete, unset
Resets a given variable whose name is provided
39 40 41 |
# File 'lib/waw/session.rb', line 39 def reset(name) rack_session.delete(name) end |