Class: Split::Persistence::SessionAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/split/persistence/session_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ SessionAdapter

Returns a new instance of SessionAdapter


5
6
7
8
# File 'lib/split/persistence/session_adapter.rb', line 5

def initialize(context)
  @session = context.session
  @session[:split] ||= {}
end

Instance Method Details

#[](key) ⇒ Object


10
11
12
# File 'lib/split/persistence/session_adapter.rb', line 10

def [](key)
  @session[:split][key]
end

#[]=(key, value) ⇒ Object


14
15
16
# File 'lib/split/persistence/session_adapter.rb', line 14

def []=(key, value)
  @session[:split][key] = value
end

#delete(key) ⇒ Object


18
19
20
# File 'lib/split/persistence/session_adapter.rb', line 18

def delete(key)
  @session[:split].delete(key)
end

#keysObject


22
23
24
# File 'lib/split/persistence/session_adapter.rb', line 22

def keys
  @session[:split].keys
end