Class: Waw::Session

Inherits:
Object show all
Extended by:
FullState::OnInstance
Defined in:
lib/waw/session.rb

Instance Method Summary collapse

Methods included from FullState::OnInstance

query_var, session_var

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

#clearObject

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

Returns:



22
23
24
# File 'lib/waw/session.rb', line 22

def has_key?(name)
  rack_session.has_key?(name)
end

#inspectObject

Inspects the session



46
47
48
# File 'lib/waw/session.rb', line 46

def inspect
  rack_session.inspect
end

#rack_sessionObject

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